mirror of
https://github.com/ION606/COGMOD-HWI.git
synced 2026-05-14 14:06:57 +00:00
added files
This commit is contained in:
Binary file not shown.
+118
@@ -0,0 +1,118 @@
|
||||
# Homework I
|
||||
|
||||
## Problem I
|
||||
1. false
|
||||
2. false
|
||||
3. true
|
||||
4. false
|
||||
5. false
|
||||
6. true
|
||||
7. false
|
||||
8. false
|
||||
|
||||
## Problem II
|
||||
|
||||
|
||||
## Problem III (Git and GitHub)
|
||||
### Part I
|
||||
see https://github.com/ION606/COGMOD-HWI
|
||||
|
||||
### Part II
|
||||
see COMMIT_HASH_HERE
|
||||
|
||||
### Part III
|
||||
|
||||
#### `git restore`
|
||||
|
||||
**Purpose**: Used to restore files in your working directory to a particular state. It can undo changes either in the working directory or the staging area (index)
|
||||
|
||||
- **Undo local changes**: You can restore a file to its last committed state or a specific commit state
|
||||
- **Undo staged changes**: You can also use it to unstage files
|
||||
|
||||
**Common use cases**:
|
||||
- Discard local changes in the working directory:
|
||||
```bash
|
||||
git restore <file>
|
||||
```
|
||||
- Unstage files (remove from staging area):
|
||||
```bash
|
||||
git restore --staged <file>
|
||||
```
|
||||
|
||||
#### `git checkout`
|
||||
|
||||
**Purpose**: `git checkout` was (and is) kind of a bundle of commands and could:
|
||||
1. Switch branches
|
||||
2. Restore files in the working directory or staging area
|
||||
3. Checkout a specific commit or branch
|
||||
|
||||
However, they finally split it into `git restore` and `git switch` for restoring files and switching (respectivly). `git checkout` is still used for switching branches and checking out commits
|
||||
|
||||
**Common use cases**:
|
||||
- Switch branches:
|
||||
```bash
|
||||
git checkout <branch-name>
|
||||
```
|
||||
- Checkout a specific commit (detached HEAD state):
|
||||
```bash
|
||||
git checkout <commit-hash>
|
||||
```
|
||||
|
||||
|
||||
#### `git reset`
|
||||
|
||||
**Purpose**: resets the current branch to a specific commit
|
||||
**Affects**:
|
||||
1. **The working directory** (with `--hard`).
|
||||
2. **The staging area** (with `--soft` or `--mixed`).
|
||||
3. **The commit history** (with any form of `git reset`).
|
||||
|
||||
**Types of `git reset`**:
|
||||
- **`--soft`**: Only moves the HEAD to a previous commit, leaving both the staging area and working directory unchanged (useful for undoing single commits)
|
||||
```bash
|
||||
git reset --soft <commit-hash>
|
||||
```
|
||||
- **`--mixed`** (default): Moves the HEAD and resets the staging area to the specified commit, but leaves the working directory unchanged. This is useful for un-staging files but keeping local changes
|
||||
```bash
|
||||
git reset <commit-hash>
|
||||
```
|
||||
- **`--hard`**: Resets the HEAD, staging area, and working directory to match a specific commit. This **discards all local changes** (and is what I usually use)
|
||||
```bash
|
||||
git reset --hard <commit-hash>
|
||||
```
|
||||
|
||||
#### `git revert`
|
||||
|
||||
**Purpose**: Creates a new commit that undoes the changes of a previous commit, but doesn't change the commit history
|
||||
|
||||
**`git revert` vs `git reset`**:
|
||||
- **`git reset`**: Alters the commit history (reverts to a previous state of the repository, but changes can be discarded if not committed)
|
||||
- **`git revert`**: Does not modify history; it adds a new commit that undoes the effects of a previous commit
|
||||
<br><br>
|
||||
|
||||
<!-- I hate that this has to be h3 to look not terrible, totally disrupts the hirearchy but whatever -->
|
||||
### <ins>Example Table!</ins>
|
||||
|
||||
| Command | Purpose | Affects | Example |
|
||||
|------------------|-----------------------------------------------|----------------------------------------|--------------------------|
|
||||
| `git restore` | Undo changes in the working directory or staging area | Working directory, staging area | `git restore example.txt` (discard local changes) |
|
||||
| `git checkout` | Switch branches or check out specific commits | Working directory, HEAD (when switching branches or commits) | `git checkout feature-branch` (switch branches) |
|
||||
| `git reset` | Reset the current branch to a specific commit | Working directory, staging area, commit history (depends on flags) | `git reset --hard HEAD~1` (discard all changes and move HEAD) |
|
||||
| `git revert` | Undo a commit by creating a new commit | Commit history (creates new commit to reverse changes) | `git revert abc1234` (undo changes with a new commit) |
|
||||
|
||||
<br>
|
||||
|
||||
### Part IV
|
||||
|
||||
| Command | Affects Commit History? | Affects Staging Area? | Affects Working Directory? | Typical Use Case |
|
||||
|--------------|-------------------------|-----------------------|----------------------------|------------------------------------------------------------|
|
||||
| `git reset` | Yes (depends on flags) | Yes (depends on flags) | Yes (with `--hard`) | To undo commits, unstage files, or reset to a previous state |
|
||||
| `git restore`| No | Yes | Yes | To discard changes in the working directory or unstage files |
|
||||
| `git rm` | No | Yes | Yes | To remove files from the working directory and staging area |
|
||||
|
||||
|
||||
## Question III (Python and NumPy)
|
||||
see [part3.py](part3.py)
|
||||
|
||||
|
||||
*Problem 4 in it's own folder*
|
||||
@@ -0,0 +1,14 @@
|
||||
name: cogmod_homework_one
|
||||
dependencies:
|
||||
- python == 3.12
|
||||
- pip
|
||||
- pip:
|
||||
- matplotlib >= 3.10.0
|
||||
- numpy >= 1.26.3
|
||||
- numba >= 0.60.0
|
||||
- seaborn >= 0.13.2
|
||||
- scipy >= 1.15.1
|
||||
- ipython >= 8.26.0
|
||||
- notebook >= 7.3.2
|
||||
- pystan 3.10.0
|
||||
- tensorflow >= 2.18.0
|
||||
@@ -0,0 +1,2 @@
|
||||
this is some text...yippie
|
||||
bottom text
|
||||
@@ -0,0 +1,22 @@
|
||||
import random
|
||||
|
||||
def monteCarlo(numPoints: int) -> float:
|
||||
pInside = 0
|
||||
|
||||
for _ in range(numPoints):
|
||||
x = random.uniform(-1, 1)
|
||||
y = random.uniform(-1, 1)
|
||||
|
||||
# (x^2 + y^2 <= 1)
|
||||
if x**2 + y**2 <= 1:
|
||||
pInside += 1
|
||||
|
||||
# approx π
|
||||
estimate = 4 * (pInside / numPoints)
|
||||
return estimate
|
||||
|
||||
|
||||
# I don't know if an example is needed, but I added one anyways
|
||||
numPoints = 1000000 # higher -> more accurate
|
||||
piApprox = monteCarlo(numPoints)
|
||||
print(f"Approximated value of π: {piApprox}")
|
||||
@@ -0,0 +1,39 @@
|
||||
# Cognative Modeling Spring 2025
|
||||
> Team members: Itamar Oren-N, Annabelle Choi
|
||||
|
||||

|
||||
|
||||
## Why is cognitive modeling important for psychology and cognitive science?
|
||||
|
||||
1. **Understanding Cognitive Processes**
|
||||
- Models can simulate how the brain processes information (like memory, attention, decision-making, etc)
|
||||
- Helps refine theories of how we think, remember, and act
|
||||
|
||||
2. **Theory Testing**
|
||||
- Models allow researchers to formalize and test cognitive theories
|
||||
- Offers a way to validate or refine hypotheses about mental functions
|
||||
|
||||
3. **Predictive**
|
||||
- Models can predict cognitive behaviors and outcomes, which can then be tested
|
||||
- Example: Predicting how multitasking affects performance
|
||||
|
||||
4. **Exploring Cognitive Limits**
|
||||
- Models explore cognitive limits (like memory capacity and attention span) and their implications for real-world tasks
|
||||
- Useful in designing better tools, apps, or educational methods
|
||||
|
||||
5. **Individual Differences**
|
||||
- Tailors models to individual cognitive profiles (like memory or attention variations)
|
||||
- Helps in diagnosing cognitive disorders or understanding learning differences
|
||||
|
||||
6. **Guiding Interventions**
|
||||
- Models inform therapies and cognitive rehabilitation
|
||||
- for an example of user for alzheimers, see [this link](https://alz-journals.onlinelibrary.wiley.com/doi/10.1002/alz.13886)
|
||||
- Offers targeted strategies for cognitive impairments or developmental issues
|
||||
|
||||
7. **Improving Experimental Design**
|
||||
- Cognitive models help design experiments that directly test cognitive theories
|
||||
- Streamlines hypothesis testing by simulating experimental conditions
|
||||
|
||||
10. **Advancing Interdisciplinary Research**
|
||||
- Serves as a sort of bridge between psychology, neuroscience, and AI
|
||||
|
||||
Reference in New Issue
Block a user