Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing "purity" to "precision" #1098

Merged
merged 3 commits into from
Aug 5, 2024
Merged
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
4 changes: 2 additions & 2 deletions modules/spatiotemporal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ labaled_pdf2_fn - labeled_pdf from another independent sampling

output_fn - name of output file (default: 'temporal_precision.txt')

### purity(labeled_pdf_fn,output_fn)
Function that reads in one labeled_pdf from create_DAG and returns the purity, defined as the sum of the squared probability of all trajectories.
### precision(labeled_pdf_fn,output_fn)
Function that reads in one labeled_pdf from create_DAG and returns the precision, defined as the sum of the squared probability of all trajectories.

labeled_pdf_fn - labeled_pdf from the total model

Expand Down
11 changes: 6 additions & 5 deletions modules/spatiotemporal/pyext/src/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ def temporal_precision(labeled_pdf1_fn, labeled_pdf2_fn,
print(precision)


def purity(labeled_pdf_fn, output_fn='purity.txt'):
def precision(labeled_pdf_fn, output_fn='precision.txt'):
"""
Function that reads in one labeled_pdf from create_DAG and returns the
purity, defined as the sum of the squared probability of all trajectories.
precision, defined as the sum of the squared
probability of all trajectories.

@param labeled_pdf_fn: string, labeled pdf file name (including the path);
labeled_pdf from the total model
@param output_fn: string, name of output file
(default: 'temporal_precision.txt')
@return temporal purity, written to output_fn
@return temporal precision, written to output_fn
"""
# create blank dictonary to store the results
prob_list = []
Expand All @@ -114,7 +115,7 @@ def purity(labeled_pdf_fn, output_fn='purity.txt'):
for prob in prob_list:
pure += prob * prob
with open(output_fn, 'w') as new:
new.write('Purity of ' + labeled_pdf_fn + ':\n')
new.write('Precision of ' + labeled_pdf_fn + ':\n')
new.write(str(pure))
print('Purity of ' + labeled_pdf_fn)
print('Precision of ' + labeled_pdf_fn)
print(str(pure))
Loading