Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ShallowSink
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
a272-jones
ShallowSink
Commits
e77314ff
Commit
e77314ff
authored
1 month ago
by
c72-taylor
Browse files
Options
Downloads
Patches
Plain Diff
model
parent
3904f846
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Working Models/Linear_training.py
+6
-4
6 additions, 4 deletions
Working Models/Linear_training.py
with
6 additions
and
4 deletions
Working Models/Linear_training.py
+
6
−
4
View file @
e77314ff
...
@@ -269,19 +269,21 @@ def main():
...
@@ -269,19 +269,21 @@ def main():
with
open
(
model_path
,
'
w
'
)
as
f
:
with
open
(
model_path
,
'
w
'
)
as
f
:
json
.
dump
(
prediction_params
,
f
,
indent
=
2
)
json
.
dump
(
prediction_params
,
f
,
indent
=
2
)
# Save human-readable results to the same directory
# Save human-readable metrics in the same folder as the input CSV
output_path
=
os
.
path
.
join
(
script_dir
,
"
Training_Results.txt
"
)
input_dir
=
os
.
path
.
dirname
(
file_path
)
if
os
.
path
.
dirname
(
file_path
)
else
"
.
"
output_path
=
os
.
path
.
join
(
input_dir
,
"
Model_Metrics.txt
"
)
with
open
(
output_path
,
"
w
"
)
as
f
:
with
open
(
output_path
,
"
w
"
)
as
f
:
f
.
write
(
f
"
Train RMSE:
{
results
[
'
Train RMSE
'
]
}
\n
"
)
f
.
write
(
f
"
Train RMSE:
{
results
[
'
Train RMSE
'
]
}
\n
"
)
f
.
write
(
f
"
Test RMSE:
{
results
[
'
Test RMSE
'
]
}
\n
"
)
f
.
write
(
f
"
Test RMSE:
{
results
[
'
Test RMSE
'
]
}
\n
"
)
f
.
write
(
f
"
Train R² Score:
{
results
[
'
Train R² Score
'
]
}
\n
"
)
f
.
write
(
f
"
Train R² Score:
{
results
[
'
Train R² Score
'
]
}
\n
"
)
f
.
write
(
f
"
Test R² Score:
{
results
[
'
Test R² Score
'
]
}
\n
"
)
f
.
write
(
f
"
Test R² Score:
{
results
[
'
Test R² Score
'
]
}
\n
"
)
f
.
write
(
"
\n
Best piecewise linear model:
"
)
f
.
write
(
str
(
results
[
'
Model
'
]))
# Restore original stderr before printing
# Restore original stderr before printing
sys
.
stderr
=
original_stderr
sys
.
stderr
=
original_stderr
print
(
model_path
)
print
(
output_path
)
finally
:
finally
:
# Restore original stderr and close the null file
# Restore original stderr and close the null file
sys
.
stderr
=
original_stderr
sys
.
stderr
=
original_stderr
...
...
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