FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
solventmapcreator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
Hunter Group
SSIPtools
SSIMPLEapps
solventmapcreator
Commits
3f89efee
Commit
3f89efee
authored
7 years ago
by
M.D. Driver
Browse files
Options
Downloads
Patches
Plain Diff
started work on polynomial analysis.
parent
d85ff065
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
solventmapcreator/polynomialanalysis/polynomialdataanalysis.py
+83
-0
83 additions, 0 deletions
...ntmapcreator/polynomialanalysis/polynomialdataanalysis.py
with
83 additions
and
0 deletions
solventmapcreator/polynomialanalysis/polynomialdataanalysis.py
0 → 100644
+
83
−
0
View file @
3f89efee
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script for analysing the polynomial fitting data.
This will provide tools to analyse which order gives the best fit to the data.
@author: mark
"""
import
logging
import
numpy
as
np
logging
.
basicConfig
()
LOGGER
=
logging
.
getLogger
(
__name__
)
LOGGER
.
setLevel
(
logging
.
WARN
)
def
get_total_by_fit_order
(
best_order_dict
):
"""
This returns a tuple containing the order, and also the number of
occurances where the corresponding order provided the best fit.
"""
order_tuple
=
tuple
(
sorted
(
best_order_dict
.
keys
()))
number_by_order
=
tuple
([
len
(
best_order_dict
[
order
])
for
order
in
order_tuple
])
return
(
order_tuple
,
number_by_order
)
def
get_best_poly_fit_rmse
(
polynomial_dict_by_solvent_id
):
"""
This returns a dict with tuples containing the information.
"""
best_rmse_order_dict
=
{}
for
solvent_id
,
polynomial_dict
in
polynomial_dict_by_solvent_id
.
items
():
best_order
,
smallest_rmse
=
extract_best_poly_fit_rmse
(
polynomial_dict
)
info_tuple
=
(
solvent_id
,
smallest_rmse
)
if
best_order
not
in
best_rmse_order_dict
.
keys
():
best_rmse_order_dict
[
best_order
]
=
[
info_tuple
]
else
:
best_rmse_order_dict
[
best_order
].
append
(
info_tuple
)
return
best_rmse_order_dict
def
extract_best_poly_fit_rmse
(
polynomial_dict
):
"""
This returns the order with the lowest value of RMSE,
and value of the RMSE.
"""
best_order
=
None
smallest_rmse
=
None
for
order
,
info
in
polynomial_dict
.
items
():
if
smallest_rmse
==
None
:
smallest_rmse
=
info
[
"
RMSE
"
]
best_order
=
order
elif
smallest_rmse
>
info
[
"
RMSE
"
]:
smallest_rmse
=
info
[
"
RMSE
"
]
best_order
=
order
return
best_order
,
smallest_rmse
def
get_best_poly_fit_covar
(
polynomial_dict_by_solvent_id
):
"""
This
"""
best_covar_order_dict
=
{}
for
solvent_id
,
polynomial_dict
in
polynomial_dict_by_solvent_id
.
items
():
best_order
,
smallest_covar
=
extract_best_poly_fit_covar
(
polynomial_dict
)
info_tuple
=
(
solvent_id
,
smallest_covar
)
if
best_order
not
in
best_covar_order_dict
.
keys
():
best_covar_order_dict
[
best_order
]
=
[
info_tuple
]
else
:
best_covar_order_dict
[
best_order
].
append
(
info_tuple
)
return
best_covar_order_dict
def
extract_best_poly_fit_covar
(
polynomial_dict
):
"""
This returns the order with the lowest covariance, and the
value of covariance.
"""
best_order
=
None
smallest_covar
=
None
for
order
,
info
in
polynomial_dict
.
items
():
if
smallest_covar
==
None
:
smallest_covar
=
info
[
"
covar
"
]
best_order
=
order
elif
smallest_covar
>
info
[
"
covar
"
]:
smallest_covar
=
info
[
"
covar
"
]
best_order
=
order
return
best_order
,
smallest_covar
\ No newline at end of file
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