Skip to content

Instantly share code, notes, and snippets.

@yassineAlouini
Created January 19, 2021 14:44
Show Gist options
  • Save yassineAlouini/f2bb5aaaf047a70f5df21d26653712dd to your computer and use it in GitHub Desktop.
Save yassineAlouini/f2bb5aaaf047a70f5df21d26653712dd to your computer and use it in GitHub Desktop.
Bad QA code
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