-
Notifications
You must be signed in to change notification settings - Fork 48
shogun lars,lasso fixes #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,22 +63,20 @@ def RunLASSOShogun(q): | |
| # If the dataset contains two files then the second file is the responses | ||
| # file. | ||
| try: | ||
| # Load input dataset. | ||
| Log.Info("Loading dataset", self.verbose) | ||
| if len(self.dataset) == 2: | ||
| testSet = np.genfromtxt(self.dataset[1], delimiter=',') | ||
| inputData = np.genfromtxt(self.dataset[0], delimiter=',') | ||
| responsesData = np.genfromtxt(self.dataset[1], delimiter=',') | ||
|
|
||
| # Get all the parameters. | ||
| lambda1 = re.search("-l (\d+)", options) | ||
| lambda1 = 0.0 if not lambda1 else int(lambda1.group(1)) | ||
|
|
||
| # Use the last row of the training set as the responses. | ||
| X, y = SplitTrainData(self.dataset) | ||
| # Get all the parameters. | ||
| lambda1 = re.search("-l (\d+\.\d+)", options) | ||
| lambda1 = 0.0 if not lambda1 else float(lambda1.group(1)) | ||
|
|
||
| with totalTimer: | ||
| model = LeastAngleRegression(lasso=True) | ||
| model = LeastAngleRegression(True) | ||
| model.set_max_l1_norm(lambda1) | ||
| model.set_labels(RegressionLabels(y)) | ||
| model.train(RealFeatures(X.T)) | ||
| model.set_labels(RegressionLabels(responsesData)) | ||
| model.train(RealFeatures(inputData.T)) | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comparing with scikit lasso doesnt make sense actually since its uses coordinate descent to solve as opposed to lars. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I get this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I just checked. This should not be merged. |
||
| except Exception as e: | ||
| print(e) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there reason this was left out?
methods/shogun/lars.pywas already present , so curious.