Created
January 19, 2021 14:44
-
-
Save yassineAlouini/f2bb5aaaf047a70f5df21d26653712dd to your computer and use it in GitHub Desktop.
Bad QA code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import svm | |
from sklearn.datasets import load_iris | |
from joblib import dump | |
from joblib import load | |
import sys | |
import os | |
import pathlib | |
import pandas as pd | |
TRAIN = False | |
def run(): | |
# Main function to train or get the model | |
if TRAIN == True: | |
clf = svm.SVC() | |
X, y = load_iris(return_X_y=True) | |
aug_X = X ** 2 + X ** 3 + X ** 4 + X ** 5 + X ** 10 + X ** 100 + X ** 24 + X ** 13 + X ** 2 + np.sin(X) + np.cos(X) | |
X = np.vstack([X, aug_X]) | |
clf.fit(X, y) | |
dump(clf, 'model.joblib') | |
else: | |
clf = load('model.joblib') | |
return clf | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment