Skip to content

Commit

Permalink
Merge pull request #8 from ipranjal/command_params
Browse files Browse the repository at this point in the history
Command params
  • Loading branch information
ipranjal authored Oct 7, 2023
2 parents 586dc34 + 88b9233 commit 263a375
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dep
run: pip3 install --no-cache-dir -r requirements.txt
- name: Run code
run: python3 digits.py
run: python3 digits.py --runs 4 --test_sizes 0.2,0.3 --dev_sizes 0.2 --models svm,tree
- name: Run test cases
run: python3 -m pytest
- run: echo "This statment is added to echo as part of quiz question 1"
Expand Down
28 changes: 23 additions & 5 deletions digits.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from utils import preprocess_data, tune_hparams, split_train_dev_test,read_digits,predict_and_eval
from joblib import load
import pandas as pd
import argparse, sys

# The digits dataset consists of 8x8 pixel images of digits. The images attribute of the dataset stores 8x8 arrays of grayscale values for each image. We will use these arrays to visualize the first 4 images. The target attribute of the dataset stores the digit each image represents and this is included in the title of the 4 plots below.
# Note: if we were working from image files (e.g., ‘png’ files), we would load them using matplotlib.pyplot.imread.
Expand All @@ -16,18 +17,37 @@

x,y = read_digits()

parser=argparse.ArgumentParser()

parser.add_argument("--runs", help="number of runs")
parser.add_argument("--test_sizes", help="comma sprated value of test sizes")
parser.add_argument("--dev_sizes", help="comma sprated value of dev sizes")
parser.add_argument("--models", help="comma sprated value of models")

args=parser.parse_args()

max_runs = int(args.runs)
test_sizes = args.test_sizes.split(',')
test_sizes = [float(i) for i in test_sizes]
dev_sizes = args.dev_sizes.split(',')
dev_sizes = [float(i) for i in dev_sizes]
models = args.models.split(',')
models = [str(i) for i in models]



#print("Total number of samples : ", len(x))

#print("(number of samples,length of image,height of image) is:",x.shape)

# test_sizes = [0.1, 0.2, 0.3]
# dev_sizes = [0.1, 0.2, 0.3]

test_sizes = [0.2]
dev_sizes = [0.2]
# test_sizes = [0.2]
# dev_sizes = [0.2]
results = []

for i in range(5):
for i in range(max_runs):
for test_size in test_sizes:
for dev_size in dev_sizes:
# 3. Data splitting
Expand All @@ -47,8 +67,6 @@
max_depth = [5,10,15,20,50,100]
classifer_hparam['tree'] = [{'max_depth': depth} for depth in max_depth]

models = ['svm','tree']

# Predict the value of the digit on the test subset
# 6.Predict and Evaluate
for model in models:
Expand Down

0 comments on commit 263a375

Please sign in to comment.