class LinearSVRImpl(): def __init__(self, epsilon=0.0, tol=0.0001, C=1.0, loss='epsilon_insensitive', fit_intercept=True, intercept_scaling=1.0, dual=True, verbose=0, random_state=None, max_iter=1000): self._hyperparams = { 'epsilon': epsilon, 'tol': tol, 'C': C, 'loss': loss, 'fit_intercept': fit_intercept, 'intercept_scaling': intercept_scaling, 'dual': dual, 'verbose': verbose, 'random_state': random_state, 'max_iter': max_iter } def fit(self, X, y=None): self._sklearn_model = SKLModel(**self._hyperparams) if (y is not None): self._sklearn_model.fit(X, y) else: self._sklearn_model.fit(X) return self def predict(self, X): return self._sklearn_model.predict(X)
X = scalerX.transform(X) #print(userDF.userData) y =userFeature.ix[:,feature] lars_cv = linear_model.LassoLarsCV(cv=6).fit(X,y) selector = feature_selection.SelectFromModel(lars_cv,prefit=True) X = selector.transform(X) selectors.append(selector) print(feature) print(X.shape) print(y.shape) clff.fit(X,y) clfPersonality.append(clff) i=i+1 samples = inputTools.sampleInputPd(inputFile) lt.predictAgeLikesid(samples, clfAge, vectorizer= vectorizerA) lt.predictGenderLikesid(samples, clfGender,vectorizer= vectorizerG) samples.featureData.rename(columns={'userId':'userid'},inplace=True) personalityData = pd.merge(samples.featureData,samples.userData,on='userid',how= 'right')