Package: lightgrid
lightgridA Fast model parameter adjustment tool
.author email:yan_shw@dlmu.edu.cnApplicable to all machine learning algorithms and deep learning algorithms conforming to sklearn code specification such as SVM,DecisionTree,XGBoost,lightGBM,RandomForest,catBoost and so onOnly rely on Python native code packagesGrid search speed is extremely fast thangridsearchCVAdapt single parameter search and multiple parameter search .even both them can be setted to run in same processUse given train data and test data to get the best parameter collectionAuto save Operation results and error log , facilitate offline trainingInstallationEasiest way is to usepip:pip install lightgridUsageTo use the tool, the importance content is  comprehend the difference betweenparamListandcrossParamList.All keys inparamListare irrelevant. When the program runs, it will only search the optimal value of one key at a time, and then turn to the next. All keys in thecrossParamListare related. When the program runs, it will search for the optimal value of the free combination of all keys in thecrossParamList. Therefore, the conclusion ofcrossParamListis often more accurate but slower. Lightgrid allows you to setparamListandcrossParamListat the same time to get the best effect, but it should be noted that there can be no key intersection betweenparamListandcrossParamList, and the number of elements incrossParamListshould be greater than 2. detail and example is given as bellow:ParametersINfunction: you should input a class name such as : testparamList: independent features assemble . type as dict ,such as {'a':[1,2,3]}crossParamList: features be valid in a crossed way  . type as dict ,such as {'a':[1,2,3],'b':[1,2,3]} . default: {}optimal_fun: optimal function ,option invoke 'R2_score' or 'succe_percent'. default :'succe_percent'silent: boolean,Whether to output logs during program operation. default :Truesave_model: boolean,save model or not. default :Falsex_train :train collection feature datay_train :train collection object datax_val :test collection feature datay_val :test collection object dataOUTbst_param :the best parameter collectionbst_score :model performance under the best parameter collection and given test datacode examplefromsklearn.treeimportDecisionTreeClassifierfromsklearn.datasetsimportload_breast_cancerimportlightgriddata=load_breast_cancer()x_train=data['data'][:400,:]y_train=data['target'][:400]x_val=data['data'][400:,:]y_val=data['target'][400:]DecisionTreeClassifier()param_grid={'max_depth':[10,20],'min_samples_split':[2,4,6,8,10],'min_samples_leaf':[1,3,5]}autograd=lightgrid.lightgrid(DecisionTreeClassifier,param_grid,valid_times=1,save_model=False)autograd.fit(x_train=x_train,y_train=y_train,x_val=x_val,y_val=y_val)print('the best param is '+str(autograd.bst_param))print('the best score is '+str(autograd.bst_score))Algorithm PerformanceUnder different data sets, the comparison between lightgrid and gridsearchCV algorithm is shown in the table below. The reason for this situation is that lightgrid algorithm is more flexible and avoids meaningless calculationAll tests are run on a 12 core (hyperthreaded) Intel(R) Xeon(R) CPU E5-2678 v3.Data SetTargetlightgrid TimegridSearchCV Timelightgrid scoregridSearchCV scorebreast_cancer0-10.76817s1.93696s0.914200.89940digits0-91.50722s3.25618s0.773650.7728wine0-30.11532s0.50491s0.384610.30769