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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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>com.oreilly.javabook</groupId>
<artifactId>Dava_Science_with_Java</artifactId>
<artifactId>Data_Science_with_Java</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/com/oreilly/dswj/dataops/MatrixResampler.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ public void calculateTestTrainSplit(double testFraction, long seed) {

Random rnd = new Random(seed);

// for (int i = 1; i <= features.getRowDimension(); i++) {
for (int i = 0; i < features.getRowDimension(); i++) {
indeces.add(i);
}
Collections.shuffle(indeces, rnd);

int testSize = new Long(Math.round(testFraction * features.getRowDimension())).intValue();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/oreilly/dswj/datasets/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Iris() throws IOException {
labels.setEntry(rowCounter, 1, 1);
break;
case "Iris-virginica":
labels.setEntry(rowCounter, 3, 1);
labels.setEntry(rowCounter, 2, 1);
break;
default:
System.out.println("something wrong with " + plantClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.reduce.IntSumReducer;
import org.apache.hadoop.mapreduce.lib.reduce.LongSumReducer;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

Expand Down Expand Up @@ -53,7 +54,7 @@ public int run(String[] args) throws Exception {
job.setMapperClass(SimpleTokenMapper.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(LongWritable.class);
job.setReducerClass(IntSumReducer.class);
job.setReducerClass(LongSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(LongWritable.class);
job.setNumReduceTasks(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public SparseMatrixWritable(int rowIndex, int columnIndex, double entry) {
@Override
public void write(DataOutput d) throws IOException {
d.writeInt(rowIndex);
d.writeInt(rowIndex);
d.writeInt(columnIndex);
d.writeDouble(entry);
}

Expand Down