Created
February 16, 2013 16:21
-
-
Save hernamesbarbara/4967525 to your computer and use it in GitHub Desktop.
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 yhat import Yhat, BaseModel | |
from sklearn import datasets | |
from sklearn.svm import SVC | |
class IrisModel(yhat.BaseModel): | |
def transform(self, data): | |
data = [ | |
data['SepalLength'], | |
data['SepalWidth'] / 2.0, | |
data['PetalLength'], | |
data['PetalWidth']^2 | |
] | |
return data | |
def predict(self, transformedData): | |
return self.clf.predict(transformedData) | |
clf = SVC().fit(X_transformed, y) | |
yhat.upload(name="irisClassifier", model=IrisModel(clf=clf)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment