Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
2,776 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,61 @@ | ||
Id,Rating,Text | ||
1,5,I only spent less than ten on these so they're good for what I paid for | ||
2,5,I'm in love with these glasses. | ||
3,5,Stylish. My kid loved them | ||
4,5,They came in great condition. | ||
5,5,These are really wonderful! | ||
6,5,these are GREAT quality | ||
7,5,She LOVES them! | ||
8,5,Love these. | ||
9,5,The quality is pretty good also. | ||
10,5,EXCELLENT PRODUCT | ||
11,5,I love them. Exactly what i wanted. | ||
12,5,Son love them | ||
13,5,He says they give him that style. | ||
14,5,Great value!!! | ||
15,5,Very complimentary! | ||
16,5,"Cute, great quality, good fit." | ||
17,5,I love these glasses!! | ||
18,5,they fit perfectly. | ||
19,5,They look expensive and the fit is perfect | ||
20,5,Sturdy and good looking for a great price | ||
21,5,Very stylish! Great accessory to compliment an outfit | ||
22,5,Thanks so much my grandson enjoy them. | ||
23,5,Daughter loves them. | ||
24,5,Makes me look smarter in my tinder profile ! | ||
25,1,the side arms keep breaking | ||
26,1,just look soooo cheap! | ||
27,1,Not my style. | ||
28,1,Mine arrived broken!! Not worth sending back. | ||
29,1,Dollar store quality. | ||
30,1,Not like picture. | ||
31,1,We're cheap and broke right away. | ||
32,1,"These are so cheap looking, they are unwearable." | ||
33,1,Very Very VERY Round ! Not at all vintage . | ||
34,1,It's a peace of garbage. Feels so cheap and plastic. | ||
35,1,feel flimsy like it would break i returned it the next day | ||
36,1,lens have too much glare | ||
37,1,they look cheaply made and plastic | ||
38,1,Very cheap looking | ||
39,1,make me headache | ||
40,1,Feel apart after a week of getting them prescribed. | ||
41,1,Really cheap looking. | ||
42,1,Glasses are crooked and not made correctly. | ||
43,1,poorly made... broke after three days | ||
44,1,Sunglasses were very small. | ||
45,1,Look fake and cheap | ||
46,1,lens fell out on first day. | ||
47,1,Not really like it! | ||
48,1,Delivered broken. | ||
49,1,"Overall, trash." | ||
50,1,"Were broken when I opened the box, very disappointed" | ||
51,1,Horrible lens fell out 2nd day! | ||
52,1,I don't like them. | ||
53,1,These hoes broke too I want my money | ||
54,1,Broke within the 3 days | ||
55,1,Little small but still good | ||
56,1,Super small | ||
57,1,Horrible desing | ||
58,1,It's broke | ||
59,1,Crooked and cheaply made. | ||
60,1,Poor quality |
This file contains 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,61 @@ | ||
Id,Rating,Text,Verified Purchase,Helpful | ||
1,5,I only spent less than ten on these so they're good for what I paid for,YES,11 | ||
2,5,I'm in love with these glasses.,YES,2 | ||
3,5,Stylish. My kid loved them,YES,2 | ||
4,5,They came in great condition.,NO,0 | ||
5,5,These are really wonderful!,YES,0 | ||
6,5,these are GREAT quality,YES,0 | ||
7,5,She LOVES them!,YES,0 | ||
8,5,Love these.,YES,0 | ||
9,5,The quality is pretty good also.,YES,3 | ||
10,5,EXCELLENT PRODUCT,YES,0 | ||
11,5,I love them. Exactly what i wanted.,NO,0 | ||
12,5,Son love them,YES,0 | ||
13,5,He says they give him that style.,YES,0 | ||
14,5,Great value!!!,YES,0 | ||
15,5,Very complimentary!,YES,0 | ||
16,5,"Cute, great quality, good fit.",YES,1 | ||
17,5,I love these glasses!!,YES,0 | ||
18,5,they fit perfectly.,YES,0 | ||
19,5,They look expensive and the fit is perfect,NO,0 | ||
20,5,Sturdy and good looking for a great price,YES,0 | ||
21,5,Very stylish! Great accessory to compliment an outfit,YES,0 | ||
22,5,Thanks so much my grandson enjoy them.,YES,0 | ||
23,5,Daughter loves them.,YES,0 | ||
24,5,Makes me look smarter in my tinder profile !,YES,0 | ||
25,1,the side arms keep breaking,YES,0 | ||
26,1,just look soooo cheap!,NO,0 | ||
27,1,Not my style.,NO,0 | ||
28,1,Mine arrived broken!! Not worth sending back.,YES,0 | ||
29,1,Dollar store quality.,YES,5 | ||
30,1,Not like picture.,NO,0 | ||
31,1,We're cheap and broke right away. ,YES,0 | ||
32,1,"These are so cheap looking, they are unwearable.",YES,0 | ||
33,1,Very Very VERY Round ! Not at all vintage .,YES,0 | ||
34,1,It's a peace of garbage. Feels so cheap and plastic.,YES,0 | ||
35,1,feel flimsy like it would break i returned it the next day,NO,0 | ||
36,1,lens have too much glare,YES,0 | ||
37,1,they look cheaply made and plastic,YES,0 | ||
38,1,Very cheap looking,NO,0 | ||
39,1,make me headache,YES,0 | ||
40,1,Feel apart after a week of getting them prescribed.,NO,0 | ||
41,1,Really cheap looking.,YES,0 | ||
42,1,Glasses are crooked and not made correctly.,YES,7 | ||
43,1,poorly made... broke after three days,YES,2 | ||
44,1,Sunglasses were very small.,NO,0 | ||
45,1,Look fake and cheap,YES,0 | ||
46,1,lens fell out on first day.,NO,0 | ||
47,1,Not really like it!,YES,2 | ||
48,1,Delivered broken.,YES,0 | ||
49,1,"Overall, trash.",YES,0 | ||
50,1,"Were broken when I opened the box, very disappointed",NO,0 | ||
51,1,Horrible lens fell out 2nd day!,YES,5 | ||
52,1,I don't like them.,NO,0 | ||
53,1,These hoes broke too I want my money,NO,0 | ||
54,1,Broke within the 3 days,NO,0 | ||
55,1,Little small but still good,NO,4 | ||
56,1,Super small,NO,0 | ||
57,1,Horrible desing,NO,0 | ||
58,1,It's broke,NO,0 | ||
59,1,Crooked and cheaply made.,NO,0 | ||
60,1,Poor quality,YES,0 |
This file contains 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,13 @@ | ||
Id,Price (USD),Type,Focus | ||
1,949,MIRRORLESS,MANUAL | ||
2,99,DSLR,BOTH | ||
3,90,DSLR,BOTH | ||
4,80,DSLR,AUTO | ||
5,20,COMPACT,MANUAL | ||
6,50,COMPACT,AUTO | ||
7,49,COMPACT,AUTO | ||
8,30,COMPACT,AUTO | ||
9,800,MIRRORLESS,AUTO | ||
10,789,MIRRORLESS,MANUAL | ||
11,35,COMPACT,AUTO | ||
12,789,MIRRORLESS,BOTH |
This file contains 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,31 @@ | ||
Consumption,Temperature | ||
0.386,5.00 | ||
0.374,13.33 | ||
0.393,17.22 | ||
0.425,20.00 | ||
0.406,20.56 | ||
0.344,18.33 | ||
0.327,16.11 | ||
0.288,8.33 | ||
0.269,0.00 | ||
0.256,-4.44 | ||
0.286,-2.22 | ||
0.298,-3.33 | ||
0.329,0.00 | ||
0.318,4.44 | ||
0.381,12.78 | ||
0.381,17.22 | ||
0.47,22.22 | ||
0.443,22.22 | ||
0.386,19.44 | ||
0.342,15.56 | ||
0.319,6.67 | ||
0.307,4.44 | ||
0.284,0.00 | ||
0.326,-2.78 | ||
0.309,-2.22 | ||
0.359,0.56 | ||
0.376,5.00 | ||
0.416,11.11 | ||
0.437,17.78 | ||
0.548,21.67 |
This file contains 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,31 @@ | ||
Id,Temperature,Consumption | ||
1,5.00,0.386 | ||
2,13.33,0.374 | ||
3,17.22,0.393 | ||
4,20.00,0.425 | ||
5,20.56,0.406 | ||
6,18.33,0.344 | ||
7,16.11,0.327 | ||
8,8.33,0.288 | ||
9,0.00,0.269 | ||
10,-4.44,0.256 | ||
11,-2.22,0.286 | ||
12,-3.33,0.298 | ||
13,0.00,0.329 | ||
14,4.44,0.318 | ||
15,12.78,0.381 | ||
16,17.22,0.381 | ||
17,22.22,0.47 | ||
18,22.22,0.443 | ||
19,19.44,0.386 | ||
20,15.56,0.342 | ||
21,6.67,0.319 | ||
22,4.44,0.307 | ||
23,0.00,0.284 | ||
24,-2.78,0.326 | ||
25,-2.22,0.309 | ||
26,0.56,0.359 | ||
27,5.00,0.376 | ||
28,11.11,0.416 | ||
29,17.78,0.437 | ||
30,21.67,0.548 |
This file contains 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,124 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>ai.preferred</groupId> | ||
<artifactId>regression-analysis</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.0</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-surefire-provider</artifactId> | ||
<version>1.2.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>5.2.0</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.6.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>java</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.1.0</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<minimizeJar>false</minimizeJar> | ||
<finalName>${project.artifactId}-${project.version}-jar-with-dependencies</finalName> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
|
||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
|
||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
</testResource> | ||
</testResources> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>[1.7,1.8)</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>nz.ac.waikato.cms.weka</groupId> | ||
<artifactId>weka-stable</artifactId> | ||
<version>3.8.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-csv</artifactId> | ||
<version>1.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>args4j</groupId> | ||
<artifactId>args4j</artifactId> | ||
<version>2.33</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.8.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>19.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jfree</groupId> | ||
<artifactId>jfreechart</artifactId> | ||
<version>1.5.0</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
66 changes: 66 additions & 0 deletions
66
src/main/java/ai/preferred/regression/ApplyRegression.java
This file contains 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,66 @@ | ||
package ai.preferred.regression; | ||
|
||
import ai.preferred.regression.io.ARFFDataReader; | ||
import ai.preferred.regression.io.CSVInputData; | ||
import ai.preferred.regression.io.CSVUtils; | ||
import org.apache.commons.csv.CSVPrinter; | ||
import org.kohsuke.args4j.Option; | ||
import weka.classifiers.Classifier; | ||
import weka.core.Instances; | ||
import weka.core.SerializationHelper; | ||
|
||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.util.ArrayList; | ||
|
||
public class ApplyRegression extends Command { | ||
|
||
@Option(name = "-s", aliases = {"--train"}, usage = "the path to the training data", required = true) | ||
private File train; | ||
|
||
@Option(name = "-i", aliases = {"--test"}, usage = "the path to the testing data", required = true) | ||
private File test; | ||
|
||
@Option(name = "-o", aliases = {"--output"}, usage = "the path to the output CSV file", required = true) | ||
private File output; | ||
|
||
@Option(name = "-m", aliases = {"--model"}, usage = "the path to the model file", required = true) | ||
private File model; | ||
|
||
@Option(name = "-h", aliases = {"--header"}, usage = "specifies if the input CSV files have headers") | ||
private boolean header = true; | ||
|
||
@Override | ||
protected void exec() throws Exception { | ||
try (final FileInputStream stream = new FileInputStream(model)) { | ||
final Classifier classifier = (Classifier) SerializationHelper.read(stream); | ||
final boolean nominal = WekaUtils.isLogisticClassifier(classifier); | ||
|
||
final ARFFDataReader reader = new ARFFDataReader(train, nominal, header); | ||
final Instances data = reader.read(test); | ||
|
||
try (final CSVPrinter printer = CSVUtils.printer(output); | ||
final CSVInputData csvData = CSVUtils.reader(test, header)) { | ||
if (csvData.hasHeader()) { | ||
printer.printRecord(csvData.getHeader()); | ||
} | ||
|
||
int index = 0; | ||
for (final ArrayList<String> record : csvData) { | ||
final double prediction = classifier.classifyInstance(data.get(index)); | ||
if (nominal) { | ||
record.set(0, data.classAttribute().value((int) prediction)); | ||
} else { | ||
record.set(0, String.valueOf(prediction)); | ||
} | ||
printer.printRecord(record); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
parseArgsAndRun(ApplyRegression.class, args); | ||
} | ||
|
||
} |
Oops, something went wrong.