Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (51 sloc) 995 Bytes
metadata:
title: Save for classification
short title: Predict and save
example start: 3
example end: 3
documentation: "https://docassemble.org/docs/ml.html#SimpleTextMachineLearner.new_entry"
---
modules:
- docassemble.base.util
---
code: |
ml = SVMMachineLearner(group_id='demo')
---
code: |
entry = ml.new_entry()
---
code: |
entry.save()
entry_saved = True
---
mandatory: true
code: |
while entry_saved and try_again:
del entry
del entry_saved
del try_again
---
question: |
Enter some text.
fields:
- no label: entry.independent
---
question: |
The prediction
subquestion: |
<%
predictions = entry.predict(probabilities=True)
%>
The text provided was:
> ${ entry.independent }
% if len(predictions):
The prediction was:
% for prediction in predictions:
* ${ '%s (%f)' % prediction }
% endfor
% else:
There is not enough training data
to make a prediction yet.
% endif
field: try_again
continue button label: Try again