Skip to content
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
6 changes: 4 additions & 2 deletions rsmtool/utils/cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ def create_xval_files(configuration, output_dir, logger=None):
located_filepaths[additional_filename] = DataReader.locate_files(additional_file,
configuration.configdir)

# read the training file into a dataframe
df_train = DataReader.read_from_file(located_filepaths["train"])
# read the training file into a dataframe making sure that the specified
# ID column is read as a string
df_train = DataReader.read_from_file(located_filepaths["train"],
converters={configuration["id_column"]: str})

# we need to sub-sample the full training data file to create a dummy
# test file that we need to use when running RSMTool on the full
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
feature,sign,transform
FEATURE1,1,raw
FEATURE2,1,raw
FEATURE3,1,raw
FEATURE4,1,raw
FEATURE5,1,raw
FEATURE6,1,raw
FEATURE7,1,raw
FEATURE8,1,raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"train_file": "../../files/train_with_int_ids.csv",
"id_column": "ID",
"use_scaled_predictions": true,
"train_label_column": "score",
"trim_max": 6,
"features": "features.csv",
"trim_min": 1,
"model": "LinearRegression",
"experiment_id": "lr_xval_subgroups_with_int_ids",
"description": "Cross-validation with subgroups using a LinearRegression model.",
"folds": 3,
"subgroups": "QUESTION, L1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
,1,2,3,4,5,6
1,10,0,0,0,0,0
2,5,14,20,8,0,0
3,0,6,148,56,0,0
4,0,5,54,124,6,0
5,0,0,3,22,14,5
6,0,0,0,0,0,0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
OLS Regression Results
==============================================================================
Dep. Variable: error R-squared: 0.226
Model: OLS Adj. R-squared: 0.213
Method: Least Squares F-statistic: 17.90
Date: Mon, 05 Dec 2022 Prob (F-statistic): 1.55e-23
Time: 10:18:34 Log-Likelihood: -418.08
No. Observations: 500 AIC: 854.2
Df Residuals: 491 BIC: 892.1
Df Model: 8
Covariance Type: nonrobust
======================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------------
Intercept 0.1437 0.056 2.583 0.010 0.034 0.253
group[T.Esperanto] 0.1202 0.070 1.714 0.087 -0.018 0.258
group[T.Vulcan] 0.0531 0.070 0.753 0.452 -0.085 0.192
group[T.Navi] 0.0898 0.072 1.242 0.215 -0.052 0.232
sc1_cat[T.4.0] -0.4385 0.054 -8.106 0.000 -0.545 -0.332
sc1_cat[T.2.0] 0.5566 0.119 4.672 0.000 0.323 0.791
sc1_cat[T.5.0] -0.6957 0.132 -5.289 0.000 -0.954 -0.437
sc1_cat[T.1.0] -0.1557 0.151 -1.028 0.304 -0.453 0.142
sc1_cat[T.6.0] -1.0962 0.255 -4.300 0.000 -1.597 -0.595
==============================================================================
Omnibus: 0.842 Durbin-Watson: 1.951
Prob(Omnibus): 0.656 Jarque-Bera (JB): 0.921
Skew: 0.093 Prob(JB): 0.631
Kurtosis: 2.902 Cond. No. 12.0
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
OLS Regression Results
==============================================================================
Dep. Variable: error R-squared: 0.222
Model: OLS Adj. R-squared: 0.208
Method: Least Squares F-statistic: 15.52
Date: Mon, 05 Dec 2022 Prob (F-statistic): 2.27e-22
Time: 10:18:32 Log-Likelihood: -419.36
No. Observations: 500 AIC: 858.7
Df Residuals: 490 BIC: 900.9
Df Model: 9
Covariance Type: nonrobust
=======================================================================================
coef std err t P>|t| [0.025 0.975]
---------------------------------------------------------------------------------------
Intercept 0.2056 0.063 3.260 0.001 0.082 0.330
group[T.QUESTION_2] -0.0205 0.080 -0.256 0.798 -0.178 0.137
group[T.QUESTION_3] 0.0064 0.080 0.079 0.937 -0.151 0.163
group[T.QUESTION_4] -0.0192 0.080 -0.240 0.811 -0.176 0.138
group[T.QUESTION_5] 0.0382 0.080 0.478 0.633 -0.119 0.195
sc1_cat[T.4.0] -0.4383 0.054 -8.079 0.000 -0.545 -0.332
sc1_cat[T.2.0] 0.5644 0.119 4.735 0.000 0.330 0.799
sc1_cat[T.5.0] -0.6913 0.132 -5.240 0.000 -0.951 -0.432
sc1_cat[T.1.0] -0.1358 0.151 -0.901 0.368 -0.432 0.160
sc1_cat[T.6.0] -1.0959 0.256 -4.286 0.000 -1.598 -0.594
==============================================================================
Omnibus: 1.102 Durbin-Watson: 1.965
Prob(Omnibus): 0.576 Jarque-Bera (JB): 1.185
Skew: 0.106 Prob(JB): 0.553
Kurtosis: 2.892 Cond. No. 11.9
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
partition,responses,QUESTION,L1
Evaluation,500,5,4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
L1,N responses
Esperanto,127
Klingon,134
Navi,112
Vulcan,127
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
QUESTION,N responses
QUESTION_1,100
QUESTION_2,100
QUESTION_3,100
QUESTION_4,100
QUESTION_5,100
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
,estimate,P>[t],[0.025,0.975]
Intercept (Klingon),0.14371615626712164,0.010077648544458582,0.034403182956072934,0.25302912957817036
Esperanto,0.1201524025190724,0.08724962442199663,-0.017620977874182084,0.2579257829123269
Vulcan,0.053060878641616974,0.4519886311634529,-0.08544565623984617,0.1915674135230801
Navi,0.08981475350949022,0.2146500580603286,-0.052213853274118205,0.23184336029309865
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
,estimate,P>[t],[0.025,0.975]
Intercept (QUESTION_1),0.20561961276165294,0.0011929751469464535,0.08167923947729966,0.3295599860460062
QUESTION_2,-0.02048904265529182,0.7978927165512018,-0.17761214337615977,0.13663405806557616
QUESTION_3,0.006352366216412747,0.9367182284374929,-0.15077073450445533,0.16347546693728082
QUESTION_4,-0.01916310126748497,0.8107144450384802,-0.17628620198835304,0.1379599994533831
QUESTION_5,0.03823700620144775,0.6327552739507185,-0.11888609451942035,0.19536010692231587
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
,estimate,P>[t],[0.025,0.975]
Intercept (Klingon),0.3500187870074969,3.269602548731321e-09,0.23590713367982113,0.46413044033517264
Esperanto,0.10988068449406141,0.18753701333376407,-0.05370616594803765,0.2734675349361605
Vulcan,0.08783874956429061,0.29194513158045354,-0.07574810087780845,0.2514256000063897
Navi,0.011199049875453275,0.8965342579855275,-0.15791844622545095,0.18031654597635752
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
,estimate,P>[t],[0.025,0.975]
Intercept (QUESTION_1),0.3964494250434669,7.707825783974912e-09,0.26389732800199284,0.529001522084941
QUESTION_2,0.01001246649486721,0.9164640698097066,-0.17744450686217986,0.19746943985191426
QUESTION_3,0.003031231427693834,0.9746676030130312,-0.18442574192935324,0.19048820478474088
QUESTION_4,-0.0025936199003852994,0.9783238009703221,-0.19005059325743234,0.18486335345666177
QUESTION_5,0.021043348912588994,0.8255268678090131,-0.16641362444445823,0.20850032226963622
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
,estimate,P>[t],[0.025,0.975]
Intercept (Klingon),-0.07013027763312152,0.20172599184562864,-0.17791741009500894,0.03765685482876591
Esperanto,0.13061962203433042,0.09737411793545175,-0.023900595694817423,0.28513983976347823
Vulcan,0.07704495524650336,0.32773974330783273,-0.07747526248264448,0.2315651729756512
Navi,0.11354085939010969,0.1631935015066603,-0.046203473658037036,0.27328519243825644
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
,estimate,P>[t],[0.025,0.975]
Intercept (QUESTION_1),0.007062231800578481,0.9118229849825947,-0.11817370319586766,0.1322981667970246
QUESTION_2,-0.020489042655292267,0.8202885719601136,-0.19759940042374155,0.156621315113157
QUESTION_3,0.0063523662164124695,0.9438482227440212,-0.1707579915520368,0.18346272398486174
QUESTION_4,-0.019163101267485206,0.8317379986389686,-0.1962734590359345,0.15794725650096406
QUESTION_5,0.03823700620144721,0.6716181098920564,-0.1388733515670022,0.21534736396989662
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
,N,h_mean,h_sd,h_min,h_max,sys_mean,sys_sd,sys_min,sys_max,corr,wtkappa,R2,kappa,exact_agr,adj_agr,SMD,RMSE
scale,500,3.42,0.8154323146156515,1.0,6.0,3.4263003427946264,0.8126288620270699,0.1621791602182347,5.264647059606723,0.6938894813074243,0.6938645425724713,0.3898121393083943,0.39719727806605976,0.0,89.2,0.0077263835166945264,0.6363337680454727
scale_trim,500,3.42,0.8154323146156515,1.0,6.0,3.4280496774995948,0.8060272072934709,0.5002,5.264647059606723,0.693118818879626,0.6930379526464026,0.3930860300927974,0.40940598675826056,0.0,89.2,0.009871668506771165,0.6346243853102554
scale_trim_round,500,3.42,0.8154323146156515,1.0,6.0,3.42,0.8538490008382426,1.0,5.0,0.6585465545561128,0.6578493387004025,0.28270042194092815,0.40940598675826056,62.0,96.8,0.0,0.6899275324264136
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
,N,h_mean,h_sd,sys_mean.scale_trim,sys_sd.scale_trim,wtkappa.scale_trim,corr.scale_trim,DSM.scale_trim,RMSE.scale_trim,R2.scale_trim,sys_mean.scale_trim_round,sys_sd.scale_trim_round,kappa.scale_trim_round,exact_agr.scale_trim_round,adj_agr.scale_trim_round,DSM.scale_trim_round
All data,500.0,3.42,0.8154323146156515,3.4280496774995948,0.8060272072934709,0.6930379526464026,0.693118818879626,6.217248937900877e-17,0.6346243853102554,0.3930860300927974,3.42,0.8538490008382426,0.40940598675826056,62.0,96.8,2.1316282072803006e-17
Esperanto,127.0,3.409448818897638,0.8577779591022434,3.469938163298847,0.858852166186036,0.6861755651025806,0.6878936267730016,0.06490844261447487,0.67815888367075,0.3699916276670101,3.47244094488189,0.932880601536397,0.414260677059312,60.629921259842526,93.7007874015748,0.07435648887668148
Klingon,134.0,3.514925373134328,0.6573479941145337,3.444795095501207,0.6770813813143276,0.6061974480422792,0.6098371556522522,-0.09563584894086286,0.5916238560162163,0.18388036105614725,3.4402985074626864,0.7409726794741347,0.4260707635009311,65.67164179104478,98.50746268656717,-0.09263815301656057
Navi,112.0,3.4017857142857144,0.7879706107448952,3.4451962960427025,0.8076256156024779,0.714152632091404,0.7154363046914077,0.0436099704275069,0.6010140072269116,0.4129917676046473,3.4107142857142856,0.8548069844678275,0.4023330851327873,61.60714285714286,98.21428571428571,0.011461843626968674
Vulcan,127.0,3.3464566929133857,0.9375580638603729,3.353371370526767,0.8768380313059618,0.7321861840360077,0.7338495120879609,-0.0024605129279010045,0.6617080448141667,0.49792377311486147,3.354330708661417,0.8866519785313858,0.39103046257991714,59.84251968503938,96.8503937007874,0.013279621501260556
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
,N,h_mean,h_sd,sys_mean.scale_trim,sys_sd.scale_trim,wtkappa.scale_trim,corr.scale_trim,DSM.scale_trim,RMSE.scale_trim,R2.scale_trim,sys_mean.scale_trim_round,sys_sd.scale_trim_round,kappa.scale_trim_round,exact_agr.scale_trim_round,adj_agr.scale_trim_round,DSM.scale_trim_round
All data,500.0,3.42,0.8154323146156515,3.4280496774995948,0.8060272072934709,0.6930379526464026,0.693118818879626,6.217248937900877e-17,0.6346243853102554,0.3930860300927974,3.42,0.8538490008382426,0.40940598675826056,62.0,96.8,2.1316282072803006e-17
QUESTION_1,100.0,3.42,0.8187203614806647,3.427062231800578,0.8037949045883143,0.6958053015937654,0.6959497042538934,-0.001225077379623546,0.6296422992806839,0.40257771994655456,3.45,0.8333333333333335,0.40129194895226095,62.0,97.0,0.03513501798391561
QUESTION_2,100.0,3.42,0.8187203614806647,3.4065731891452855,0.8085147977508976,0.6899461089645683,0.6900952897347663,-0.026644867766218196,0.6375436389286101,0.3874896149211363,3.42,0.8896713727636466,0.388846447669977,60.0,96.0,4.4408920985006264e-17
QUESTION_3,100.0,3.42,0.8187203614806647,3.4334145980169906,0.8056752573009025,0.6942129405489885,0.694398140344168,0.006656004250043512,0.6320448215681862,0.3980098606522601,3.42,0.8666666666666668,0.39693830214937387,61.0,97.0,2.886579864025407e-17
QUESTION_4,100.0,3.42,0.8187203614806647,3.4078991305330932,0.8028589324756209,0.6974722126270024,0.6976841626691107,-0.02499983472538649,0.6275793217937325,0.40648612847636933,3.38,0.8260897302498332,0.4796594134342479,67.0,97.0,-0.04684669064522076
QUESTION_5,100.0,3.42,0.8187203614806646,3.465299238002026,0.8239319301354149,0.6879088865089498,0.6889796029034916,0.04621377562118496,0.6461368074611259,0.3708668264676671,3.43,0.8675403521602109,0.38176197836166925,60.0,97.0,0.011711672661305217
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
,N,h_mean,h_sd,sys_mean.scale_trim,sys_sd.scale_trim,wtkappa.scale_trim,corr.scale_trim,SMD.scale_trim,RMSE.scale_trim,R2.scale_trim,sys_mean.scale_trim_round,sys_sd.scale_trim_round,kappa.scale_trim_round,exact_agr.scale_trim_round,adj_agr.scale_trim_round,SMD.scale_trim_round
0,500,3.42,0.8154323146156515,3.4280496774995948,0.8060272072934709,0.6930379526464026,0.693118818879626,0.009871668506771165,0.6346243853102554,0.3930860300927974,3.42,0.8538490008382426,0.40940598675826056,62.0,96.8,0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
,Overall score accuracy,Overall score difference,Conditional score difference,base_category
R2,-0.0009715120520623621,0.0004896717751495805,0.0003996508694116274,Klingon
sig,0.4731525810191193,0.3564855691119414,0.35558262106862704,Klingon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
,Overall score accuracy,Overall score difference,Conditional score difference,base_category
R2,-0.007919476324596886,-0.006936965075233781,-0.0052704533076012305,QUESTION_1
sig,0.9992327852265073,0.9670727676895057,0.9494126032415746,QUESTION_1
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
OLS Regression Results
==============================================================================
Dep. Variable: SE R-squared: 0.005
Model: OLS Adj. R-squared: -0.001
Method: Least Squares F-statistic: 0.8386
Date: Mon, 05 Dec 2022 Prob (F-statistic): 0.473
Time: 10:18:34 Log-Likelihood: -508.95
No. Observations: 500 AIC: 1026.
Df Residuals: 496 BIC: 1043.
Df Model: 3
Covariance Type: nonrobust
======================================================================================
coef std err t P>|t| [0.025 0.975]
--------------------------------------------------------------------------------------
Intercept 0.3500 0.058 6.027 0.000 0.236 0.464
group[T.Esperanto] 0.1099 0.083 1.320 0.188 -0.054 0.273
group[T.Vulcan] 0.0878 0.083 1.055 0.292 -0.076 0.251
group[T.Navi] 0.0112 0.086 0.130 0.897 -0.158 0.180
==============================================================================
Omnibus: 424.928 Durbin-Watson: 1.954
Prob(Omnibus): 0.000 Jarque-Bera (JB): 8496.746
Skew: 3.718 Prob(JB): 0.00
Kurtosis: 21.777 Cond. No. 4.65
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
OLS Regression Results
==============================================================================
Dep. Variable: SE R-squared: 0.000
Model: OLS Adj. R-squared: -0.008
Method: Least Squares F-statistic: 0.01981
Date: Mon, 05 Dec 2022 Prob (F-statistic): 0.999
Time: 10:18:32 Log-Likelihood: -510.17
No. Observations: 500 AIC: 1030.
Df Residuals: 495 BIC: 1051.
Df Model: 4
Covariance Type: nonrobust
=======================================================================================
coef std err t P>|t| [0.025 0.975]
---------------------------------------------------------------------------------------
Intercept 0.3964 0.067 5.876 0.000 0.264 0.529
group[T.QUESTION_2] 0.0100 0.095 0.105 0.916 -0.177 0.197
group[T.QUESTION_3] 0.0030 0.095 0.032 0.975 -0.184 0.190
group[T.QUESTION_4] -0.0026 0.095 -0.027 0.978 -0.190 0.185
group[T.QUESTION_5] 0.0210 0.095 0.221 0.826 -0.166 0.209
==============================================================================
Omnibus: 431.628 Durbin-Watson: 1.939
Prob(Omnibus): 0.000 Jarque-Bera (JB): 9016.874
Skew: 3.789 Prob(JB): 0.00
Kurtosis: 22.375 Cond. No. 5.83
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Binary file not shown.
Loading