Skip to content

Commit

Permalink
add command line arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ipranjal committed Oct 7, 2023
1 parent 586dc34 commit ef814df
Showing 1 changed file with 23 additions and 5 deletions.
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 ef814df

Please sign in to comment.