Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ease
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ease
Commits
693c2f89
Commit
693c2f89
authored
Oct 30, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix problem with new xserver
parent
6b7405b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
model_creator.py
+2
-2
tests/test_models.py
+1
-1
No files found.
model_creator.py
View file @
693c2f89
...
@@ -107,7 +107,7 @@ def extract_features_and_generate_model(essays,additional_array=None):
...
@@ -107,7 +107,7 @@ def extract_features_and_generate_model(essays,additional_array=None):
return
f
,
clf
return
f
,
clf
def
dump_model_to_file
(
prompt_string
,
feature_ext
,
classifier
,
model_path
):
def
dump_model_to_file
(
prompt_string
,
feature_ext
,
classifier
,
text
,
score
,
model_path
):
"""
"""
Writes out a model to a file.
Writes out a model to a file.
prompt string is a string containing the prompt
prompt string is a string containing the prompt
...
@@ -115,7 +115,7 @@ def dump_model_to_file(prompt_string, feature_ext, classifier, model_path):
...
@@ -115,7 +115,7 @@ def dump_model_to_file(prompt_string, feature_ext, classifier, model_path):
classifier is a trained classifier
classifier is a trained classifier
model_path is the path of write out the model file to
model_path is the path of write out the model file to
"""
"""
model_file
=
{
'prompt'
:
prompt_string
,
'extractor'
:
feature_ext
,
'model'
:
classifier
}
model_file
=
{
'prompt'
:
prompt_string
,
'extractor'
:
feature_ext
,
'model'
:
classifier
,
'text'
:
text
,
'score'
:
score
}
pickle
.
dump
(
model_file
,
file
=
open
(
model_path
,
"w"
))
pickle
.
dump
(
model_file
,
file
=
open
(
model_path
,
"w"
))
def
create_essay_set_and_dump_model
(
text
,
score
,
prompt
,
model_path
,
additional_array
=
None
):
def
create_essay_set_and_dump_model
(
text
,
score
,
prompt
,
model_path
,
additional_array
=
None
):
...
...
tests/test_models.py
View file @
693c2f89
...
@@ -28,7 +28,7 @@ def main(argv):
...
@@ -28,7 +28,7 @@ def main(argv):
print
(
"essay set created"
)
print
(
"essay set created"
)
feature_ext
,
classifier
=
model_creator
.
extract_features_and_generate_model
(
e_set
)
feature_ext
,
classifier
=
model_creator
.
extract_features_and_generate_model
(
e_set
)
print
(
"features pulled out and model generated"
)
print
(
"features pulled out and model generated"
)
model_creator
.
dump_model_to_file
(
prompt_string
,
feature_ext
,
classifier
,
args
.
model_path
)
model_creator
.
dump_model_to_file
(
prompt_string
,
feature_ext
,
classifier
,
text
,
score
,
args
.
model_path
)
print
(
"model file written"
)
print
(
"model file written"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment