Today, give a try to Techtonique web app, a tool designed
to help you make informed, data-driven decisions using Mathematics, Statistics, Machine Learning,
and Data Visualization.
Here is a tutorial with audio, video, code, and slides: https://moudiki2.gumroad.com/l/nrhgb
The model presented here is a frequentist – conformalized – version of the Bayesian one presented in #152. It is implemented in learningmachine, both in Python and R, and is updated as new observations arrive, using Polyak averaging. Model explanations are given as sensitivity analyses.
# Split the data into training and testing setsfromsklearn.model_selectionimporttrain_test_splitX_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=123)# Create a Bayesian RVFL regressor objectobj=lm.Regressor(method="bayesianrvfl",nb_hidden=5)# Fit the model using the training dataobj.fit(X_train,y_train,reg_lambda=12.9155)# Print the summary of the modelprint(obj.summary(X_test,y=y_test,show_progress=False))
$R_squared
[1] 0.6416309$R_squared_adj
[1] 1.537554$ResidualsMin.1stQu.MedianMean3rdQu.Max.-4.0724-2.0122-0.1018-0.19411.43613.9676$Coverage_rate
[1] 100$citestsestimatelowerupperp-valuesignifcyl-24.5943583-40.407994-8.78072308.909365e-03**disp-0.2419797-0.370835-0.11312453.711077e-03**hp-1.5734483-1.722903-1.42399392.255640e-07***drat142.5646192124.575179160.55405991.217808e-06***wt-144.8871352-158.911143-130.86312752.523441e-07***qsec46.829085927.82941165.82876119.388045e-04***vs75.055514630.645127119.46590176.110043e-03**am207.5935234133.205572281.98147444.843095e-04***gear73.689265860.18623287.19229951.091470e-05***carb-71.2974988-79.480400-63.11459746.944475e-07***$effects──DataSummary────────────────────────ValuesNameeffectsNumberofrows7Numberofcolumns10_______________________Column type frequency:numeric10________________________GroupvariablesNone──Variable type:numeric──────────────────────────────────────────────────────skim_variablemeansdp0p25p50p75p1001cyl-24.617.1-38.5-38.5-33.4-12.41.662disp-0.2420.139-0.351-0.351-0.285-0.1810.005463hp-1.570.162-1.90-1.61-1.48-1.47-1.474drat143.19.5125.125.141.154.174.5wt-145.15.2-167.-152.-142.-142.-117.6qsec46.820.514.135.355.762.462.47vs75.148.037.237.258.793.9167.8am208.80.464.3168.250.267.267.9gear73.714.660.660.672.782.196.910carb-71.38.85-84.4-75.2-69.7-69.7-55.2hist1▇▁▂▁▃2▇▂▁▂▂3▂▁▁▃▇4▇▂▂▂▂5▂▅▇▁▂6▃▁▁▂▇7▇▁▃▁▂8▂▂▁▂▇9▇▂▂▂▂10▂▅▇▁▂
# Select the first test samplenewx=X_test.iloc[0,:]newy=y_test[0]# Update the model with the new samplenew_X_test=X_test[1:]new_y_test=y_test[1:]obj.update(newx,newy,method="polyak",alpha=0.9)# Print the summary of the modelprint(obj.summary(new_X_test,y=new_y_test,show_progress=False))
$R_squared
[1] 0.6051442$R_squared_adj
[1] 1.394856$ResidualsMin.1stQu.MedianMean3rdQu.Max.-4.6214-2.5055-1.5003-0.83081.27383.2794$Coverage_rate
[1] 100$citestsestimatelowerupperp-valuesignifcyl-30.0502823-48.4171958-11.6833698.442658e-03**disp-0.2958477-0.4386085-0.1530873.121989e-03**hp-1.6053302-1.6789750-1.5316853.424156e-08***drat153.7968829131.5239191176.0698471.041460e-05***wt-155.1954135-174.4144275-135.9763994.804729e-06***qsec49.896768526.999377872.7941592.504905e-03**vs87.417076432.4599776142.3741759.457226e-03**am214.5918910119.8712855309.3124962.108825e-03**gear83.135582565.3159018100.9552637.110354e-05***carb-77.1384645-88.2087477-66.0681819.958425e-06***$effects──DataSummary────────────────────────ValuesNameeffectsNumberofrows6Numberofcolumns10_______________________Column type frequency:numeric10________________________GroupvariablesNone──Variable type:numeric──────────────────────────────────────────────────────skim_variablemeansdp0p25p50p75p1001cyl-30.117.5-42.5-42.5-39.9-17.7-4.352disp-0.2960.136-0.377-0.377-0.343-0.308-0.02693hp-1.610.0702-1.70-1.66-1.57-1.57-1.534drat154.21.2137.137.144.169.185.5wt-155.18.3-182.-160.-154.-154.-125.6qsec49.921.818.833.360.666.666.67vs87.452.446.746.773.7105.178.8am215.90.365.6169.266.275.275.9gear83.117.070.070.075.594.1109.10carb-77.110.5-92.5-79.9-76.6-76.6-59.7hist1▇▁▁▁▃2▇▂▁▁▂3▅▁▁▇▂4▇▂▁▁▅5▂▂▇▁▂6▅▁▁▂▇7▇▁▅▁▂8▂▂▁▁▇9▇▂▁▂▂10▂▂▇▁▂
Comments powered by Talkyard.