File tree 1 file changed +25
-3
lines changed
1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 3
3
# in Python
4
4
#-------------------------------------------------------------
5
5
6
+ #--------------------------------------------------
7
+ # Example 1: Linear and Quadratic regression models
8
+ #--------------------------------------------------
9
+
6
10
# 1. generate artificial data
7
11
import numpy as np
8
12
np .random .seed (2023 )
79
83
# [16.169293289892607, 7.873829105930071]
80
84
# The second model (Quadratic) has the lowest RMSE and thus is prefered.
81
85
82
- #----
83
- # end
84
- #----
86
+ #---------------------------------------
87
+ # Example 2: binomial regressions models
88
+ #---------------------------------------
89
+
90
+ # importing the data from .csv file
91
+
92
+ training = pd .read_csv ("C:/Users/julia/OneDrive/Desktop/github/16. Crossvalidation/mtcars_training.csv" )
93
+ testing = pd .read_csv ("C:/Users/julia/OneDrive/Desktop/github/16. Crossvalidation/mtcars_testing.csv" )
94
+ testing
95
+
96
+ # 2. Cross-Validation
97
+ # fit the models on leave-one-out samples
98
+ from sklearn .linear_model import LogisticRegression
99
+
100
+ # logistic model
101
+ modl = LogisticRegression (random_state = 0 ).fit_transform (training ['mpg' ])
102
+ modl1 = LogisticRegression .fit (mod1 , training ['vs' ])
103
+
104
+ #-----------
105
+ # unfinished
106
+ #-----------
You can’t perform that action at this time.
0 commit comments