class LarsImpl(): def __init__(self, fit_intercept=True, verbose=False, normalize=True, precompute='auto', n_nonzero_coefs=500, eps=2.220446049250313e-16, copy_X=True, fit_path=True, positive=False): self._hyperparams = { 'fit_intercept': fit_intercept, 'verbose': verbose, 'normalize': normalize, 'precompute': precompute, 'n_nonzero_coefs': n_nonzero_coefs, 'eps': eps, 'copy_X': copy_X, 'fit_path': fit_path, 'positive': positive } self._wrapped_model = SKLModel(**self._hyperparams) def fit(self, X, y=None): if (y is not None): self._wrapped_model.fit(X, y) else: self._wrapped_model.fit(X) return self def predict(self, X): return self._wrapped_model.predict(X)
def connectWidgets(self): # LARS/ # LARSCV lars = Lars() self.fit_interceptCheckBox.setChecked(lars.fit_intercept) self.normalizeCheckBox.setChecked(lars.normalize) self.n_nonzero_coefsSpinBox.setValue(lars.n_nonzero_coefs)
def run(self): if self.cVCheckBox.isChecked(): params = { 'fit_intercept': self.fit_interceptCheckBox.isChecked(), 'positive': self.positiveCheckBox.isChecked(), 'max_iter': self.max_iterSpinBox.value(), 'verbose': self.verboseCheckBox.isChecked(), 'normalize': self.normalizeCheckBox.isChecked(), 'precompute': self.precomputeComboBox.currentText(), 'copy_X': self.copy_XCheckBox.isChecked(), 'cv': self.cvSpinBox.value(), 'max_n_alphas': self.max_n_alphasSpinBox.value(), 'n_jobs': self.n_jobsSpinBox.value(), 'CV': self.cVCheckBox.isChecked(), } return params, self.getChangedValues(params, LarsCV()) else: params = { 'fit_intercept': self.fit_interceptCheckBox.isChecked(), 'verbose': self.verboseCheckBox.isChecked(), 'normalize': self.normalizeCheckBox.isChecked(), 'precompute': { 'True': True, 'False': False, 'auto': 'auto', 'array-like': 'array-like' }.get(self.precomputeComboBox.currentText()), 'n_nonzero_coefs': self.n_nonzero_coefsSpinBox.value(), 'copy_X': self.copy_XCheckBox.isChecked(), 'fit_path': self.fit_pathCheckBox.isChecked(), 'positive': self.positiveCheckBox.isChecked(), 'CV': self.cVCheckBox.isChecked(), } return params, self.getChangedValues(params, Lars())
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 connectWidgets(self): lars = Lars() self.fit_intercept_listWidget.setCurrentItem( self.fit_intercept_listWidget.findItems(str(lars.fit_intercept), QtCore.Qt.MatchExactly)[0]) self.normalize_list.setCurrentItem( self.normalize_list.findItems(str(lars.normalize), QtCore.Qt.MatchExactly)[0]) self.n_nonzero_coefsLineEdit.setText(str(lars.n_nonzero_coefs))
def run(self): params = { 'fit_intercept': self.fit_interceptCheckBox.isChecked(), 'verbose': False, 'normalize': self.normalizeCheckBox.isChecked(), 'precompute': 'auto', 'n_nonzero_coefs': self.n_nonzero_coefsSpinBox.value(), 'copy_X': True, 'fit_path': True } return params, self.getChangedValues(params, Lars())
def connectWidgets(self): # LARS/ # LARSCV lars = Lars() larscv = LarsCV() self.fit_interceptCheckBox.setChecked(lars.fit_intercept) self.verboseCheckBox.setChecked(lars.verbose) self.normalizeCheckBox.setChecked(lars.normalize) self.setComboBox(self.precomputeComboBox, ['True', 'False', 'auto', 'array-like']) self.defaultComboItem(self.precomputeComboBox, lars.precompute) self.n_nonzero_coefsSpinBox.setValue(lars.n_nonzero_coefs) self.copy_XCheckBox.setChecked(lars.copy_X) self.fit_pathCheckBox.setChecked(lars.fit_path) self.positiveCheckBox.setChecked(lars.positive) self.max_iterSpinBox.setValue(larscv.max_iter) self.max_n_alphasSpinBox.setValue(larscv.max_n_alphas) self.n_jobsSpinBox.setValue(larscv.n_jobs)
def __init__(self, fit_intercept=True, verbose=False, normalize=True, precompute='auto', n_nonzero_coefs=500, eps=2.220446049250313e-16, copy_X=True, fit_path=True, positive=False): self._hyperparams = { 'fit_intercept': fit_intercept, 'verbose': verbose, 'normalize': normalize, 'precompute': precompute, 'n_nonzero_coefs': n_nonzero_coefs, 'eps': eps, 'copy_X': copy_X, 'fit_path': fit_path, 'positive': positive } self._wrapped_model = SKLModel(**self._hyperparams)
'HuberRegressor':HuberRegressor(), 'Imputer':Imputer(), 'IncrementalPCA':IncrementalPCA(), 'IsolationForest':IsolationForest(), 'Isomap':Isomap(), 'KMeans':KMeans(), 'KNeighborsClassifier':KNeighborsClassifier(), 'KNeighborsRegressor':KNeighborsRegressor(), 'KernelCenterer':KernelCenterer(), 'KernelDensity':KernelDensity(), 'KernelPCA':KernelPCA(), 'KernelRidge':KernelRidge(), 'LSHForest':LSHForest(), 'LabelPropagation':LabelPropagation(), 'LabelSpreading':LabelSpreading(), 'Lars':Lars(), 'LarsCV':LarsCV(), 'Lasso':Lasso(), 'LassoCV':LassoCV(), 'LassoLars':LassoLars(), 'LassoLarsCV':LassoLarsCV(), 'LassoLarsIC':LassoLarsIC(), 'LatentDirichletAllocation':LatentDirichletAllocation(), 'LedoitWolf':LedoitWolf(), 'LinearDiscriminantAnalysis':LinearDiscriminantAnalysis(), 'LinearRegression':LinearRegression(), 'LinearSVC':LinearSVC(), 'LinearSVR':LinearSVR(), 'LocallyLinearEmbedding':LocallyLinearEmbedding(), 'LogisticRegression':LogisticRegression(), 'LogisticRegressionCV':LogisticRegressionCV(),