Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
event-wikifier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shyam Upadhyay
event-wikifier
Commits
5d6c4129
Commit
5d6c4129
authored
9 years ago
by
Shyam Upadhyay
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
08552c8d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
run.sh
+1
-0
1 addition, 0 deletions
run.sh
src/main/java/edu/illinois/cs/cogcomp/features/MyTrainer.java
+35
-34
35 additions, 34 deletions
...main/java/edu/illinois/cs/cogcomp/features/MyTrainer.java
with
36 additions
and
34 deletions
run.sh
+
1
−
0
View file @
5d6c4129
...
...
@@ -12,6 +12,7 @@ MAIN="$PACKAGE_PREFIX.nytlabs.corpus.ACEEvents"
MAIN
=
"
$PACKAGE_PREFIX
.nytlabs.corpus.core.NYTAnnotations"
MAIN
=
"
$PACKAGE_PREFIX
.salience.learning.Main"
MAIN
=
"
$PACKAGE_PREFIX
.readers.LazyNYTReader"
MAIN
=
"
$PACKAGE_PREFIX
.features.MyTrainer"
#MAIN="$PACKAGE_PREFIX.nytlabs.corpus.core.Evaluator"
#MAIN="$PACKAGE_PREFIX.features.AllFeatures"
...
...
This diff is collapsed.
Click to expand it.
src/main/java/edu/illinois/cs/cogcomp/features/MyTrainer.java
+
35
−
34
View file @
5d6c4129
...
...
@@ -45,20 +45,20 @@ public class MyTrainer {
NoisyLabeler
trainReader
=
new
NoisyLabeler
(
d1
);
NoisyLabeler
testReader
=
new
NoisyLabeler
(
d2
);
//
NoisySupervisionReader train
Reader = new
NoisySupervision
Reader(new NoisyLabeler(d1), true);
//
NoisySupervisionReader tes
tReader = new
NoisySupervision
Reader(new NoisyLabeler(d2), false);
Flat
Reader
f1
=
new
Flat
Reader
(
new
NoisyLabeler
(
d1
),
true
);
Fla
tReader
f2
=
new
Flat
Reader
(
new
NoisyLabeler
(
d2
),
false
);
getDist
(
trainReader
);
getDist
(
testReader
);
trainReader
.
reset
();
testReader
.
reset
();
getDist
(
trainReader
);
getDist
(
testReader
);
//
getDist(trainReader);
//
getDist(testReader);
//
trainReader.reset();
//
testReader.reset();
//
getDist(trainReader);
//
getDist(testReader);
//
MyClassifier learner = new MyClassifier();
//
BatchTrainer trainer = new BatchTrainer(learner, trainReader);
//
trainer.train(1);
MyClassifier
learner
=
new
MyClassifier
();
BatchTrainer
trainer
=
new
BatchTrainer
(
learner
,
trainReader
);
trainer
.
train
(
1
);
// getFeatureWeights(learner);
...
...
@@ -74,13 +74,14 @@ public class MyTrainer {
// LazyNYTReader goldReader = new LazyNYTReader(cc, alreadyCached, docs);
// NoisySupervisionReader gold= new NoisySupervisionReader(goldReader);
// trainReader.reset();
// testReader.reset();
trainReader
.
reset
();
testReader
.
reset
();
f1
.
reset
();
f2
.
reset
();
// on train data
//
test(learner, new AllFeatures(),
trainReader
);
test
(
learner
,
new
AllFeatures
(),
f1
);
// on test data
//
test(learner, new AllFeatures(),
testReader
);
test
(
learner
,
new
AllFeatures
(),
f2
);
// LazyNYTReader.main();
}
...
...
@@ -144,23 +145,23 @@ public class MyTrainer {
System
.
out
.
println
(
"Dist: pos-"
+
pos
+
" neg-"
+
neg
);
}
//
public static void test(MyClassifier learner, AllFeatures feat,
NoisySupervision
Reader gold){
//
MyClassifier c = new MyClassifier();
//
//
// SparseNetworkLearner.Parameters params = new SparseNetworkLearner.Parameters();
//
// c.setParameters(params);
//
//
TestDiscrete.testDiscrete(new TestDiscrete(), c, new MyLabel(), gold, true, 1000);
//
//
// EventInstance inst= (EventInstance) gold.next();
//
// while(inst!=null) {
//
// FeatureVector f = feat.classify(inst);
//
// System.out.println(f.featuresSize());
//
// String ans = learner.discreteValue(f);
//
// ScoreSet ss = learner.scores(inst);
//
// System.out.println(ss.values()+" "+ans);
//
// inst= (EventInstance) gold.next();
//
// }
//
}
public
static
void
test
(
MyClassifier
learner
,
AllFeatures
feat
,
Flat
Reader
gold
){
MyClassifier
c
=
new
MyClassifier
();
// SparseNetworkLearner.Parameters params = new SparseNetworkLearner.Parameters();
// c.setParameters(params);
TestDiscrete
.
testDiscrete
(
new
TestDiscrete
(),
c
,
new
MyLabel
(),
gold
,
true
,
1000
);
// EventInstance inst= (EventInstance) gold.next();
// while(inst!=null) {
// FeatureVector f = feat.classify(inst);
// System.out.println(f.featuresSize());
// String ans = learner.discreteValue(f);
// ScoreSet ss = learner.scores(inst);
// System.out.println(ss.values()+" "+ans);
// inst= (EventInstance) gold.next();
// }
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment