Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신은섭(Shin Eun Seop)
/
Detecting_fraud_clicks
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
신은섭(Shin Eun Seop)
2018-06-12 20:25:41 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d7db0a3dbe7538ccc8bda26c4c255f12747cb967
d7db0a3d
1 parent
b8aacf59
fix model load
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
pom.xml
src/main/java/detact/ML/DecisionTree.java
src/main/java/detact/Main.java
pom.xml
View file @
d7db0a3
...
...
@@ -52,6 +52,7 @@
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
detact.Aggregation
</mainClass>
</transformer>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
/>
</transformers>
<filters>
<filter>
...
...
@@ -78,6 +79,7 @@
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
detact.ML.DecisionTree
</mainClass>
</transformer>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
/>
</transformers>
<filters>
<filter>
...
...
@@ -104,6 +106,7 @@
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
detact.Main
</mainClass>
</transformer>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"
/>
</transformers>
<filters>
<filter>
...
...
src/main/java/detact/ML/DecisionTree.java
View file @
d7db0a3
...
...
@@ -107,7 +107,13 @@ public class DecisionTree {
System
.
out
.
println
(
"Learned regression tree model:\n"
+
treeModel
.
toDebugString
());
// save model
model
.
save
(
"./decisionTree.model"
);
model
.
save
(
"./decisionTree"
);
// load model
PipelineModel
load_mode
=
PipelineModel
.
load
(
"./decisionTree"
);
// Make predictions.
Dataset
<
Row
>
load_pred
=
model
.
transform
(
testData
);
}
...
...
src/main/java/detact/Main.java
View file @
d7db0a3
...
...
@@ -78,8 +78,13 @@ public class Main {
// Train model. This also runs the indexer.
PipelineModel
model
=
pipeline
.
fit
(
trainingData
);
// save model
model
.
save
(
"./decisionTree"
);
PipelineModel
p_model
=
PipelineModel
.
load
(
"./decisionTree"
);
// Make predictions.
Dataset
<
Row
>
predictions
=
model
.
transform
(
testData
);
Dataset
<
Row
>
predictions
=
p_
model
.
transform
(
testData
);
// Select example rows to display.
predictions
.
select
(
"is_attributed"
,
"features"
).
show
(
5
);
...
...
@@ -93,10 +98,8 @@ public class Main {
System
.
out
.
println
(
"Root Mean Squared Error (RMSE) on test result = "
+
rmse
);
DecisionTreeRegressionModel
treeModel
=
(
DecisionTreeRegressionModel
)
(
model
.
stages
()[
1
]);
(
DecisionTreeRegressionModel
)
(
p_
model
.
stages
()[
1
]);
System
.
out
.
println
(
"Learned regression tree model:\n"
+
treeModel
.
toDebugString
());
// save model
model
.
save
(
"./decisionTree.model"
);
}
}
...
...
Please
register
or
login
to post a comment