Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Topological_Machine_Learning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Colbry, Dirk
Topological_Machine_Learning
Commits
b88cb70f
Commit
b88cb70f
authored
5 years ago
by
shawk masboob
Browse files
Options
Downloads
Patches
Plain Diff
Adding the stubbed functions py file
parent
6acbf824
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Models/TDA_Prediction.py
+106
-0
106 additions, 0 deletions
Models/TDA_Prediction.py
with
106 additions
and
0 deletions
Models/TDA_Prediction.py
0 → 100644
+
106
−
0
View file @
b88cb70f
#!/usr/bin/env python
# coding: utf-8
# # <center>Stub Functions and Automatic Documentation</center>
#
# <img src="https://pdoc3.github.io/pdoc/logo.png" width=30% alt="Sphinx logo">
# In[1]:
from
sklearn
import
datasets
def
dataload
():
"""
upload toy datasets from scikit-learn
"""
data
=
None
return
data
def
datafetch
(
file_name
):
"""
upload real world datasets from scikit-learn
"""
data
=
None
print
(
"
reading data from:
"
,
file_name
)
return
data
def
descriptive_statistic
(
df
):
"""
Provides brief descriptive statistics on dataset.
Takes dataframe as input.
"""
print
(
"
Type :
"
,
None
,
"
\n\n
"
)
print
(
"
Shape :
"
,
None
)
print
(
"
Head --
\n
"
,
None
)
print
(
"
\n\n
Tail --
\n
"
,
None
)
print
(
"
Describe :
"
,
None
)
def
model_selection
(
df
):
"""
Takes dateframe as input. Performs foward/backward stepwise
regression. Returns best model for both methods.
"""
null_fit
=
None
foward_step
=
None
backward_step
=
None
return
foward_step
,
backward_step
def
MSE_fit
(
fit
):
"""
Takes in a fitted model as the input.
Calculates the MSU of the fitted model.
Outputs the model
'
s MSE.
"""
MSE
=
None
return
MSE
def
accuracy_metrics
(
fit
,
MSE
):
"""
This function is used for model validation. It returns a dictionary
of several regression model accuracy metrics. Its inputs are a fitted model
and the MSE of the fitted model.
"""
d
=
dict
()
sumObj
=
None
SSE
=
None
n
=
None
p
=
None
pr
=
None
d
[
'
R2
'
]
=
None
d
[
'
R2ad
'
]
=
None
d
[
'
AIC
'
]
=
None
d
[
'
BIC
'
]
=
None
d
[
'
PRESS
'
]
=
None
d
[
'
Cp
'
]
=
None
return
d
# In[3]:
# test docstring
help
(
accuracy_metrics
)
# In[ ]:
# test code
file_name
=
'
data.csv
'
a
=
datafetch
(
file_name
)
print
(
a
)
b
=
descriptive_statistic
(
a
)
print
(
b
)
c
=
model_selection
(
a
)
print
(
c
)
d
=
MSE_fit
(
c
)
print
(
d
)
print
(
accuracy_metrics
(
c
,
d
))
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