Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,17 @@ methods:
['datasets/arcene_X.csv', 'datasets/arcene_y.csv'],
['datasets/madelon_X.csv', 'datasets/madelon_y.csv']]
options: '-l 0.01'

LARS:
Copy link
Contributor Author

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.py was already present , so curious.

run: ['timing']
iteration: 3
script: methods/shogun/lars.py
format: [csv, txt]
datasets:
- files: [ ['datasets/diabetes_X.csv', 'datasets/diabetes_y.csv'],
['datasets/cosExp_X.csv', 'datasets/cosExp_y.csv'],
['datasets/arcene_X.csv', 'datasets/arcene_y.csv'],
['datasets/madelon_X.csv', 'datasets/madelon_y.csv']]
options: '-l 0.01'
QDA:
run: ['timing','metric']
script: methods/shogun/qda.py
Expand Down
4 changes: 2 additions & 2 deletions methods/scikit/lars.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def RunLARSScikit(q):
try:
with totalTimer:
# Get all the parameters.
lambda1 = re.search("-l (\d+)", options)
lambda1 = 0.0 if not lambda1 else int(lambda1.group(1))
lambda1 = re.search("-l (\d+\.\d+)", options)
lambda1 = 0.0 if not lambda1 else float(lambda1.group(1))

# Perform LARS.
model = LassoLars(alpha=lambda1)
Expand Down
4 changes: 2 additions & 2 deletions methods/shogun/lars.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def RunLARSShogun(q):
responsesFeat = RegressionLabels(responsesData)

# Get all the parameters.
lambda1 = re.search("-l (\d+)", options)
lambda1 = 0.0 if not lambda1 else int(lambda1.group(1))
lambda1 = re.search("-l (\d+\.\d+)", options)
lambda1 = 0.0 if not lambda1 else float(lambda1.group(1))

with totalTimer:
# Perform LARS.
Expand Down
20 changes: 9 additions & 11 deletions methods/shogun/lasso.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I get this.
Definitely, it only makes sense to compare against this one

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I just checked. This should not be merged.
@Saurabh7 you are right that comparing sklearn's LASSO with Shogun's LARS doesnt make any sense.
Instead, can you do the right comparison of the various LARS implementations?

except Exception as e:
print(e)
Expand Down