Created
April 29, 2020 18:10
-
-
Save TavoGLC/69d6f3225524c77ee5e182ddae6fff73 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def TrainOnPopulation(TotalFeatures,Data,Size): | |
| """ | |
| Parameters | |
| ---------- | |
| TotalFeatures : List | |
| List with the names of the categorical values in the data. | |
| Data : Pandas dataframe | |
| Training data for the model. | |
| Size : int | |
| Number of models to be trained. | |
| Returns | |
| ------- | |
| FitnessContainer : list | |
| Contains the ROC AUC score for each model. | |
| IndexContainer : list | |
| Contains the categorical features used for the model. | |
| """ | |
| maxFeatures=len(TotalFeatures) | |
| PopulationIndex=MakeRandomSizePopulation(maxFeatures,Size) | |
| IndexContainer=[] | |
| FitnessContainer=[] | |
| for k in range(Size): | |
| localIndex=PopulationIndex[k] | |
| localFeatures=[TotalFeatures[val]for val in localIndex] | |
| FitnessContainer.append(TrainModel(localFeatures,Data)) | |
| IndexContainer.append(localIndex) | |
| return FitnessContainer,IndexContainer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment