-
Notifications
You must be signed in to change notification settings - Fork 28
Add Linear Regression to Aggregator #262
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
Open
giangnm58
wants to merge
118
commits into
boalang:master
Choose a base branch
from
giangnm58:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
118 commits
Select commit
Hold shift + click to select a range
5e632cc
ml linear regression
giangnm58 f4ebacf
small fix
giangnm58 0f69517
linear regresion
giangnm58 ac90513
linear regresion
giangnm58 baf49e3
linear regresion small fix
giangnm58 e3d6da8
linear regression small fix
giangnm58 8f653fc
fix model type bug
giangnm58 4fd504a
linear regression fixing bug type
giangnm58 906c82e
linear regression fixing bug type
giangnm58 bb5088e
fix constructor bug
giangnm58 a41cf6a
add test case
giangnm58 5605f28
add weka jars
giangnm58 472d822
add weka jar and test cases into correct folders
55aa854
adding/removing line breaks
giangnm58 4cb9999
Merge branch 'master' of https://github.com/giangnm58/compiler
giangnm58 6f24ca4
adding/removing line breaks
giangnm58 7aa7638
adding/removing line breaks
giangnm58 1e7c026
adding/removing line breaks
giangnm58 127b846
change boatup to boa.runtime.Tuple
giangnm58 98bd417
edit .classpath
giangnm58 ed328d9
edit .classpath
giangnm58 636c9d2
remove unnecessary jar file
giangnm58 4a4ca6f
edit .classpath
giangnm58 dd644ca
edit .gitignore
giangnm58 2f03515
edit .classpath
giangnm58 bbea155
fix according to Dr. Robert comments
giangnm58 ecae915
small fix
giangnm58 4726525
small fix
giangnm58 5467571
edit classpath
giangnm58 df2995e
fix ML type to string
giangnm58 dbf897f
update test cases
giangnm58 4741988
update according to Dr. Robert comments
giangnm58 3b131e9
update according to Dr. Robert comments
giangnm58 afbcf3c
update according to Dr. Robert comments
giangnm58 6be1a0e
update according to Dr. Robert comments
giangnm58 37b7dd6
update according to Dr. Robert comments
giangnm58 7e2e42d
update according to Dr. Robert comments
giangnm58 fc46df8
update according to Dr. Robert comments
giangnm58 17369c9
update according to Dr. Robert comments
giangnm58 087cdd4
Merge branch 'master' into master
giangnm58 6c6bf2e
Merge pull request #266 from giangnm58/master
hyjorc1 2cb9e97
Update .classpath
giangnm58 f3cc86f
Update TestParserBad.java
giangnm58 69f1c94
Delete Query.jar
giangnm58 3d1d189
Update .classpath
giangnm58 59cd224
Merge pull request #268 from giangnm58/master
hyjorc1 0ae8239
Update classes_at_revision_test.boa
giangnm58 6a41d04
Merge pull request #269 from giangnm58/master
hyjorc1 815bb50
fix classpath
hyjorc1 71af836
update classpath
hyjorc1 19ac08d
minor fix and update classpath
hyjorc1 1eb54bc
change save and load model path
hyjorc1 5e9df22
Merge branch 'ml-2020' of https://github.com/giangnm58/compiler.git into
hyjorc1 7335868
1. move load and classify funcs to BoaMLIntrinsics. 2. use job id and
hyjorc1 7fac126
Merge pull request #270 from giangnm58/master
hyjorc1 2d4b89f
add examples of training/testing multiple models
hyjorc1 5eb917a
add model evaluation and dataset split functionalities
hyjorc1 3985e1c
Merge pull request #271 from giangnm58/master
hyjorc1 e7acf08
add adaboost aggregator
giangnm58 d281815
Update .classpath
giangnm58 ac6f9ea
Update adaboost train.boa
giangnm58 a3c02c0
Update AdaBoostM1Aggregator.java
giangnm58 df8d77d
Merge branch 'master' of https://github.com/boalang/compiler.git
hyjorc1 716009f
Merge branch 'master' of https://github.com/giangnm58/compiler.git
hyjorc1 f57436a
minor fix
hyjorc1 53fd8f4
minor fix and clean up
hyjorc1 913ae5b
minor fix
hyjorc1 e203e45
change example query
hyjorc1 c431a30
fix example query
hyjorc1 ffa3861
change train example query for adaboost
hyjorc1 258c50b
clean BoaReducer
hyjorc1 2768a73
1. BoaTuple works with enum 2. clean BoaReducer 3. update EmitValue
hyjorc1 e91e54a
fix ml aggregator with tuple input
hyjorc1 3924bfd
fix conflicts between string[] and tuple data type
hyjorc1 adeeef3
1. fix model type and tuple type 2. update example queries 3. add
hyjorc1 1c6338d
fix tuple bug in the code generator
hyjorc1 c90fa2d
clean reducer and MLAggregator to handle string[] or tuple only
hyjorc1 e66d710
remove typecast
hyjorc1 299feb7
add codegen test cases for ada and linear regression
hyjorc1 0f35af0
fix ml types
hyjorc1 294f115
Temporarily fix ml types. Need to discuss it.
hyjorc1 df3993c
Temporarily fix ml types
hyjorc1 6b9d8e6
add zeror aggregator
hyjorc1 e43b62a
clean up
hyjorc1 10eb490
add vote aggregator
hyjorc1 89e5ba3
add SMO aggregator
hyjorc1 064afb6
add kmeans (clusterer) aggregator
hyjorc1 5873416
add randomforest (classifier) aggregator
hyjorc1 279a5e4
add additiveregression
giangnm58 4e70ad5
add attribute selected classifier
giangnm58 3ca7bfc
clean up
hyjorc1 bd51e98
add part (classifier) aggregator
hyjorc1 0e289f4
add oner (classifier) aggregator
hyjorc1 dac9065
fix oner test,boa
hyjorc1 3f74b0f
add NaiveBayesMultinomialUpdateable (classifier) aggregator
hyjorc1 8f13e4a
add NaiveBayesMultinomial (classifier - not done)
hyjorc1 c106b36
add naive bayes (classifier) aggregator
hyjorc1 aa3dfd3
add MultiScheme (classifier) aggregator
hyjorc1 5dbf632
add MultiClassClassifier and MultilayerPerceptron (classifiers)
hyjorc1 2c0a633
add bagging aggregator
giangnm58 1ed0bc8
add bayesnet aggregator
giangnm58 276d230
add ClassificationViaRegression aggregator
giangnm58 cf26af2
clean up
hyjorc1 df53da2
use m = load(0, m); to load trained model
hyjorc1 25aa59a
add lwl and logitbosst (classifiers) aggregators
hyjorc1 1282ccb
add lmt and logistic (classifiers) aggregators
hyjorc1 5dfa05d
add j48, jrip, and kstar (classifiers) aggregators
hyjorc1 d9b2d53
add CVParameterSelection aggregator
giangnm58 985b3c5
add decision stump aggregator
giangnm58 24bf897
add decision table aggregator
giangnm58 cda67a6
add Filtered Classifier aggregator
giangnm58 d771491
clean up
hyjorc1 de23333
add ml aggregators
giangnm58 2f10bc7
add ml aggregators
giangnm58 f673134
add type checking
giangnm58 e3721e9
add word2vec
hyjorc1 2b51992
add seq2vec
hyjorc1 51d854b
Merge branch 'ml-2020' into master
hyjorc1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Copyright 2014, Hridesh Rajan, Robert Dyer, | ||
| * and Iowa State University of Science and Technology | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package boa.aggregators.ml; | ||
|
|
||
| import boa.runtime.Tuple; | ||
| import boa.aggregators.AggregatorSpec; | ||
| import weka.classifiers.meta.AdaBoostM1; | ||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * A Boa aggregator for training the model using AdaBoostM1. | ||
| * | ||
| * @author ankuraga | ||
| * @author nmtiwari | ||
| */ | ||
| @AggregatorSpec(name = "adaboost", formalParameters = { "string" }) | ||
| public class AdaBoostM1Aggregator extends MLAggregator { | ||
| private AdaBoostM1 model; | ||
|
|
||
| public AdaBoostM1Aggregator() { | ||
| } | ||
|
|
||
| public AdaBoostM1Aggregator(final String s) { | ||
| super(s); | ||
| } | ||
|
|
||
| @Override | ||
| public void aggregate(final String[] data, String metadata) throws IOException, InterruptedException { | ||
| aggregate(data, metadata, "AdaBoostM1"); | ||
| } | ||
|
|
||
| @Override | ||
| public void aggregate(final Tuple data, final String metadata) throws IOException, InterruptedException { | ||
| aggregate(data, metadata, "AdaBoostM1"); | ||
| } | ||
|
|
||
| @Override | ||
| public void aggregate(String data, String metadata) throws IOException, InterruptedException { | ||
| } | ||
|
|
||
| @Override | ||
| public void finish() throws IOException, InterruptedException { | ||
| try { | ||
| this.model = new AdaBoostM1(); | ||
| this.model.setOptions(options); | ||
| this.model.buildClassifier(this.trainingSet); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| this.saveModel(this.model); | ||
| this.evaluate(this.model, this.trainingSet); | ||
| this.evaluate(this.model, this.testingSet); | ||
| this.collect(this.model.toString()); | ||
| } | ||
|
|
||
| } |
70 changes: 70 additions & 0 deletions
70
src/java/boa/aggregators/ml/AdditiveRegressionAggregator.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Copyright 2014, Hridesh Rajan, Robert Dyer, | ||
| * and Iowa State University of Science and Technology | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package boa.aggregators.ml; | ||
|
|
||
| import boa.runtime.Tuple; | ||
| import boa.aggregators.AggregatorSpec; | ||
| import weka.classifiers.meta.AdditiveRegression; | ||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * A Boa aggregator for training the model using AdditiveRegression. | ||
| * | ||
| * @author ankuraga/ | ||
| * @author nmtiwari | ||
| */ | ||
| @AggregatorSpec(name = "additiveregression", formalParameters = { "string" }) | ||
| public class AdditiveRegressionAggregator extends MLAggregator { | ||
| private AdditiveRegression model; | ||
|
|
||
| public AdditiveRegressionAggregator() { | ||
| } | ||
|
|
||
| public AdditiveRegressionAggregator(final String s) { | ||
| super(s); | ||
| } | ||
|
|
||
| public void aggregate(String[] data, String metadata) throws IOException, InterruptedException { | ||
| aggregate(data, metadata, "AdditiveRegression"); | ||
| } | ||
|
|
||
| public void aggregate(final Tuple data, final String metadata) throws IOException, InterruptedException { | ||
| aggregate(data, metadata, "AdditiveRegression"); | ||
| } | ||
|
|
||
| @Override | ||
| public void aggregate(String data, String metadata) throws IOException, InterruptedException { | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| */ | ||
| @Override | ||
| public void finish() throws IOException, InterruptedException { | ||
| try { | ||
| this.model = new AdditiveRegression(); | ||
| this.model.setOptions(options); | ||
| this.model.buildClassifier(this.trainingSet); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| this.saveModel(this.model); | ||
| this.evaluate(this.model, this.trainingSet); | ||
| this.evaluate(this.model, this.testingSet); | ||
| this.collect(this.model.toString()); | ||
| } | ||
| } |
70 changes: 70 additions & 0 deletions
70
src/java/boa/aggregators/ml/AttributeSelectedClassifierAggregator.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * Copyright 2014, Hridesh Rajan, Robert Dyer, | ||
| * and Iowa State University of Science and Technology | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package boa.aggregators.ml; | ||
|
|
||
| import boa.runtime.Tuple; | ||
| import boa.aggregators.AggregatorSpec; | ||
| import weka.classifiers.meta.AttributeSelectedClassifier; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * A Boa aggregator for training the model using AttributeSelectedClassifier. | ||
| * | ||
| * @author ankuraga | ||
| */ | ||
| @AggregatorSpec(name = "attributeselectedclassifier", formalParameters = { "string" }) | ||
| public class AttributeSelectedClassifierAggregator extends MLAggregator { | ||
| private AttributeSelectedClassifier model; | ||
|
|
||
| public AttributeSelectedClassifierAggregator() { | ||
| } | ||
|
|
||
| public AttributeSelectedClassifierAggregator(final String s) { | ||
| super(s); | ||
| } | ||
|
|
||
| public void aggregate(String[] data, final String metadata) throws IOException, InterruptedException { | ||
| aggregate(data, metadata, "AttributeSelectedClassifier"); | ||
| } | ||
|
|
||
| public void aggregate(final Tuple data, final String metadata) throws IOException, InterruptedException { | ||
| aggregate(data, metadata, "AttributeSelectedClassifier"); | ||
| } | ||
|
|
||
| @Override | ||
| public void aggregate(String data, String metadata) throws IOException, InterruptedException { | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritDoc} | ||
| */ | ||
| @Override | ||
| public void finish() throws IOException, InterruptedException { | ||
| try { | ||
| this.model = new AttributeSelectedClassifier(); | ||
| this.model.setOptions(options); | ||
| this.model.buildClassifier(this.trainingSet); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| this.saveModel(this.model); | ||
| this.evaluate(this.model, this.trainingSet); | ||
| this.evaluate(this.model, this.testingSet); | ||
| this.collect(this.model.toString()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.