<s> """<STR_LIT>""" <EOL> import numpy as np <EOL> import pandas as pd <EOL> from sklearn . tree import DecisionTreeRegressor <EOL> from sklearn . datasets import load_diabetes <EOL> from nonconformist . icp import IcpRegressor <EOL> from nonconformist . nc import RegressorNc <EOL> from nonconformist . acp import AggregatedCp <EOL> from nonconformist . acp import RandomSubSampler , BootstrapSampler , CrossSampler <EOL> from nonconformist . evaluation import reg_mean_errors <EOL> data = load_diabetes ( ) <EOL> idx = np . random . permutation ( data . target . size ) <EOL> train = idx [ : int ( <NUM_LIT:2> * idx . size / <NUM_LIT:3> ) ] <EOL> test = idx [ int ( <NUM_LIT:2> * idx . size / <NUM_LIT:3> ) : ] <EOL> truth = data . target [ test ] <EOL> columns = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> significance = <NUM_LIT:0.1> <EOL> models = { '<STR_LIT>' : AggregatedCp ( <EOL> IcpRegressor ( <EOL> RegressorNc ( <EOL> DecisionTreeRegressor ( ) ) ) , <EOL> RandomSubSampler ( ) ) , <EOL> '<STR_LIT>' : AggregatedCp ( <EOL> IcpRegressor ( <EOL> RegressorNc ( <EOL> DecisionTreeRegressor ( ) ) ) , <EOL> CrossSampler ( ) ) , <EOL> '<STR_LIT>' : AggregatedCp ( <EOL> IcpRegressor ( <EOL> RegressorNc ( <EOL> DecisionTreeRegressor ( ) ) ) , <EOL> BootstrapSampler ( ) ) <EOL> } <EOL> for name , model in models . iteritems ( ) : <EOL> model . fit ( data . data [ train , : ] , data . target [ train ] ) <EOL> prediction = model . predict ( data . data [ test , : ] ) <EOL> prediction_sign = model . predict ( data . data [ test , : ] , <EOL> significance = significance ) <EOL> table = np . vstack ( ( prediction_sign . T , truth ) ) . T <EOL> df = pd . DataFrame ( table , columns = columns ) <EOL> print ( '<STR_LIT>' . format ( name ) ) <EOL> print ( '<STR_LIT>' . format ( reg_mean_errors ( prediction , <EOL> truth , <EOL> significance ) ) ) <EOL> print ( df ) </s>
