Add CLI argument for preprocessing and model
This commit is contained in:
parent
df3461e7fe
commit
dfee848680
|
@ -8,6 +8,8 @@ from sklearn.preprocessing import scale
|
||||||
from sklearn.svm import LinearSVC
|
from sklearn.svm import LinearSVC
|
||||||
from sklearn.tree import DecisionTreeClassifier
|
from sklearn.tree import DecisionTreeClassifier
|
||||||
|
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
from preprocessing import parse_data, split_k_sets
|
from preprocessing import parse_data, split_k_sets
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,9 +64,25 @@ def evaluate_performance(confusion_matrix, accuracy, cv_score, auc):
|
||||||
print("AUC: " + str(auc))
|
print("AUC: " + str(auc))
|
||||||
|
|
||||||
|
|
||||||
|
def usage():
|
||||||
|
print("Usage: " + argv[0] + "<preprocessing action> <model>")
|
||||||
|
print("preprocessing actions:")
|
||||||
|
print("fill: fills the na values with the mean")
|
||||||
|
print("drop: drops the na values")
|
||||||
|
print("models:")
|
||||||
|
print("gnb: Gaussian Naive Bayes")
|
||||||
|
print("svc: Linear Support Vector Classification")
|
||||||
|
print("knn: K-neighbors")
|
||||||
|
print("tree: Decision tree")
|
||||||
|
print("neuralnet: MLP Classifier")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
data, target = parse_data(source="data/mamografia.csv", action="drop")
|
if len(argv) != 3:
|
||||||
predict_data(data=data, target=target, model="neuralnet")
|
usage()
|
||||||
|
data, target = parse_data(source="data/mamografia.csv", action=str(argv[1]))
|
||||||
|
predict_data(data=data, target=target, model=str(argv[2]))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue