Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathML assignments + kaggle challenges #27

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b0e2a4d
initial commits. first 4 bandit
aakashks Apr 28, 2023
666e41c
created readmes
aakashks Apr 28, 2023
32c4c85
level 5 reached
aakashks Apr 28, 2023
f640a09
mit l1 completed
aakashks Apr 30, 2023
4b08bd0
folder restructuring
aakashks Apr 30, 2023
45d0b11
bandit completed till level 15
aakashks May 1, 2023
dfbe5b2
missing sem lectures and exercises completed
aakashks May 1, 2023
9586210
Merge branch 'dsgiitr:main' into main
aakashks May 1, 2023
943a8cd
task 4 done
aakashks May 1, 2023
aafd24d
added short info in git-bash-readme file
aakashks May 1, 2023
fb85ec2
added short info in git-bash-readme file
aakashks May 1, 2023
624dfee
git lab done
aakashks May 3, 2023
ce9168d
Merge line spacing conflicts.
aakashks May 3, 2023
ff31b56
added README and restructured
aakashks May 3, 2023
02103a4
script changed to train and generate predictions.
aakashks May 3, 2023
87688a6
Removed unsused packages
aakashks May 3, 2023
fcd5af2
added README
aakashks May 3, 2023
45f652e
removed cat output.txt
aakashks May 3, 2023
24454e1
small changes
aakashks May 3, 2023
6a09862
created random walk and std normal graph
aakashks May 6, 2023
4096ee1
added 2d path, poisson process
aakashks May 6, 2023
6b62891
completed all the work
aakashks May 6, 2023
97ebf9e
added images of plots
aakashks May 6, 2023
3829ba4
written README
aakashks May 6, 2023
868a03c
adding files manually.
aakashks Jun 27, 2023
87ca3d7
q4 almost done
aakashks Jun 27, 2023
3c05144
completed math ML assignments (#1)
aakashks Jun 30, 2023
8ede9d5
renamed
aakashks Jun 30, 2023
f84824c
added assignment 1 handwritten
aakashks Jun 30, 2023
172972b
added data
aakashks Jun 30, 2023
47cea14
attempted q6
aakashks Jul 1, 2023
f0971a8
completes q6 of 2A
aakashks Jul 1, 2023
8918136
moved files according to the submission format
aakashks Jul 2, 2023
efc88f1
added kalman filter repo submodule
aakashks Jul 4, 2023
71107d2
file moved
aakashks Jul 4, 2023
833d403
changed equation used for generating poisson data
aakashks Jul 8, 2023
b2b7bb5
minor changes
aakashks Jul 8, 2023
7199331
minor changes
aakashks Jul 10, 2023
b483e17
adding kaggle challenge 1 files
aakashks Aug 15, 2023
caea9d5
added README
aakashks Aug 17, 2023
7ac01e7
eda notebook
aakashks Aug 17, 2023
0bdf1c8
Removed csv files
aakashks Aug 20, 2023
ed2c11b
Removed submission files
aakashks Aug 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "assMath/probStat/aakashks/kalman_assignment"]
path = assMath/probStat/aakashks/kalman_assignment
url = https://github.com/aakashks/kalman_filter_assignment
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ https://www.kaggle.com/datasets/ahmedmohameddawoud/ecommerce-ab-testing

Look at the code contributions in the link to get an idea of how its implemented.

## MATH-2
## MATH & ML

The assignment has been divided into 3 parts and you are expected to:
### -Complete atleast one part by 21st - https://hackmd.io/1GLPNImwQbCbYNeIHc5Bww?view
### -Complete atleast two parts by 25th -https://drive.google.com/file/d/1yD35uuig5mYxQlbi3mnPl0htKtcCheHp/view?usp=sharing
### -Complete the entire assignment by 28th - https://hackmd.io/rRMAoU02RbyASZGMrubPPA?view

## ML-0
38 changes: 38 additions & 0 deletions aakashks/Git-Bash_aakashks/ML_automation/ML_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import argparse
import pandas as pd
from sklearn.ensemble import RandomForestClassifier

parser = argparse.ArgumentParser()
parser.add_argument('-d', '--train-data')
parser.add_argument('-t', '--test-data')
parser.add_argument('-f', '--target-feature')
parser.add_argument('-p', '--parameters', nargs=2, type=int)

args = parser.parse_args()

# Assuming that the data file train_data is preprocessed
train_data = pd.read_csv(args.train_data_path)
test_data = pd.read_csv(args.test_data_path)

# Separating X and y
y = train_data[args.target_feature]
X = train_data.drop(args.target_feature)
X_test = test_data.drop(args.target_feature)

model = RandomForestClassifier(
n_estimators=args.parameters[0],
max_depth=args.parameters[1],
random_state=42
)

print('Fitting model')
model.fit(X, y)

print('generating predictions')
predictions = model.predict(X_test)
output_predictions = pd.DataFrame(
{'ID': test_data.index, args.target_feature: predictions}
)

print('Saving predictions in a file')
output_predictions.to_csv('./submissions.csv', index=False)
7 changes: 7 additions & 0 deletions aakashks/Git-Bash_aakashks/ML_automation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ML automation script using bash and argparse

The script is supposed to take preprocessed csv file paths and fit the model with user defined parameters
then the predictions are output to submissions file and the logs are logged into output.txt.

It uses a Random Forest Classifier on the data. User needs to specify the n_estimators and max_depth
parameters of the sklearn model.
16 changes: 16 additions & 0 deletions aakashks/Git-Bash_aakashks/ML_automation/automate_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

output_path=./output.txt

# Getting input from user
echo 'path of training data: '
read train_data_path
echo 'path of test data: '
read test_data_path

read -p 'target feature name: ' target_feature
read -p 'model parameters: ' n_estimators max_depth

# Running python script
python ML_script.py -d $train_data_path -t $test_data_path \
-f $target_feature -p $n_estimators $max_depth &> $output_path
8 changes: 8 additions & 0 deletions aakashks/Git-Bash_aakashks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## task 1 & 2
in respective .md files

## task 4
[automate_script](automate_script.sh)

## task 5
done
68 changes: 68 additions & 0 deletions aakashks/Git-Bash_aakashks/bandit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# bandit solutions

```bash
ssh [email protected] -p 2220
```

0. cat readme
1. cat ./-
2. cat "spaces in this filename"
3.

```bash
ls -al
cat .hidden
```

4.

```bash
ll
find . -type f | xargs file | grep text
cat ./-file07
```

5. find . -type f -size 1033c ! -executable
6. find / -type f -size 33c ! -executable -user bandit7 -group bandit6 2>/dev/null

for this one handling error stream is very important as it was displaying errors with the required output. hence 2> :error stream, /dev/null is what prints null

7. cat data.txt | grep millionth
8. sort data.txt | uniq -u
9. strings data.txt | grep ===
10. base64 --decode data.txt | cat
11. cat data.txt | tr 'a-zA-Z' 'n-za-mN-ZA-M'
12.

```bash
# make folder
mkdir /tmp/temp
mkdir /tmp/t11
cd /tmp/t11
cp ~/data.txt .
mv data.txt hex_dump.txt

# convert hex dump to ASCII
xxd -r hex_dump.txt > compressed.bin

# now we'll check zip type with
file filename

# and use zcat, bzcat to get tar file
# for tar file we use tar -xvf
# after many times we get the text

zcat compressed.bin > compressed2
bzcat compressed2 > compressed3
tar -xvf compressed4
```

13. ssh -i sshkey.private [email protected] -p 2220

14.
cat /etc/bandit_pass/bandit14
echo fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq | nc localhost 30000

15.echo jN2kgmIXJ6fShzhT2avhotn4Zcka6tnt | openssl s_client -connect localhost:30001 -ign_eof

password for 16 => JQttfApK4SeyHwDlI9SXGR50qclOAil1
Loading