Name | lightgrid JSON |
Version |
4.1.0
JSON |
| download |
home_page | |
Summary | A Fast model parameter adjustment tool Using evolutionary thinking |
upload_time | 2023-03-22 07:20:39 |
maintainer | |
docs_url | None |
author | shuwei Yan |
requires_python | >=3.5 |
license | MIT |
keywords |
light
grid
gridsearch
param
parameter
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# lightgrid
A Fast model parameter adjustment tool
.author email: yan_shw@dlmu.edu.cn
- Applicable to all machine learning algorithms and deep learning algorithms conforming to sklearn code specification such as SVM,DecisionTree,XGBoost,lightGBM,RandomForest,catBoost and so on
- Only rely on Python native code packages
- Grid search speed is extremely fast than [gridsearchCV](https://scikit-learn.org/0.16/modules/generated/sklearn.grid_search.GridSearchCV.html)
- Adapt single parameter search and multiple parameter search .even both them can be setted to run in same process
- Use given train data and test data to get the best parameter collection
- Auto save Operation results and error log , facilitate offline training
# Installation
Easiest way is to use `pip`:
```
pip install lightgrid
```
# Usage
To use the tool, the importance content is comprehend the difference between `paramList` and `crossParamList`.All keys in `paramList` are 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 the `crossParamList` are related. When the program runs, it will search for the optimal value of the free combination of all keys in the `crossParamList`. Therefore, the conclusion of `crossParamList` is often more accurate but slower. Lightgrid allows you to set `paramList` and `crossParamList` at the same time to get the best effect, but it should be noted that there can be no key intersection between `paramList` and `crossParamList`, and the number of elements in `crossParamList` should be greater than 2. detail and example is given as bellow: <br />
## Parameters
IN
- function: you should input a class name such as : test
- paramList: 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 :True
- save_model: boolean,save model or not. default :False
- x_train :train collection feature data
- y_train :train collection object data
- x_val :test collection feature data
- y_val :test collection object data
OUT
- bst_param :the best parameter collection
- bst_score :model performance under the best parameter collection and given test data
## code example
```python
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import load_breast_cancer
import lightgrid
data = 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 Performance
Under 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 calculation
All tests are run on a 12 core (hyperthreaded) Intel(R) Xeon(R) CPU E5-2678 v3.
|Data Set | Target | lightgrid Time| gridSearchCV Time |lightgrid score|gridSearchCV score|
| ------- | ------ | -----------| ---- | ---- | ---- |
|[breast_cancer](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_breast_cancer.html) |0-1|0.76817s | 1.93696s | 0.91420| 0.89940 |
|[digits](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_digits.html#sklearn.datasets.load_digits)|0-9| 1.50722s | 3.25618s | 0.77365 | 0.7728 |
|[wine](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_wine.html#sklearn.datasets.load_wine)|0-3| 0.11532s | 0.50491s | 0.38461 | 0.30769 |
Raw data
{
"_id": null,
"home_page": "",
"name": "lightgrid",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "light,grid,gridsearch,param,parameter",
"author": "shuwei Yan",
"author_email": "yan_shw@dlmu.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/cb/0c/c224db64672629045bf467cba956d45cbf4719ef0633a546942a3199319a/lightgrid-4.1.0.tar.gz",
"platform": "any",
"description": "# lightgrid\n\n\nA Fast model parameter adjustment tool \n.author email: yan_shw@dlmu.edu.cn \n\n- Applicable to all machine learning algorithms and deep learning algorithms conforming to sklearn code specification such as SVM,DecisionTree,XGBoost,lightGBM,RandomForest,catBoost and so on\n- Only rely on Python native code packages\n- Grid search speed is extremely fast than [gridsearchCV](https://scikit-learn.org/0.16/modules/generated/sklearn.grid_search.GridSearchCV.html)\n- Adapt single parameter search and multiple parameter search .even both them can be setted to run in same process\n- Use given train data and test data to get the best parameter collection\n- Auto save Operation results and error log , facilitate offline training\n\n# Installation\n\nEasiest way is to use `pip`:\n```\n\tpip install lightgrid\n```\n\n# Usage\nTo use the tool, the importance content is comprehend the difference between `paramList` and `crossParamList`.All keys in `paramList` are 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 the `crossParamList` are related. When the program runs, it will search for the optimal value of the free combination of all keys in the `crossParamList`. Therefore, the conclusion of `crossParamList` is often more accurate but slower. Lightgrid allows you to set `paramList` and `crossParamList` at the same time to get the best effect, but it should be noted that there can be no key intersection between `paramList` and `crossParamList`, and the number of elements in `crossParamList` should be greater than 2. detail and example is given as bellow: <br /> \n\n## Parameters\n\nIN\n- function: you should input a class name such as : test\n- paramList: independent features assemble . type as dict ,such as {'a':[1,2,3]}\n- crossParamList: features be valid in a crossed way . type as dict ,such as {'a':[1,2,3],'b':[1,2,3]} . default: {}\n- optimal_fun: optimal function ,option invoke 'R2_score' or 'succe_percent'. default :'succe_percent'\n- silent: boolean,Whether to output logs during program operation. default :True\n- save_model: boolean,save model or not. default :False\n- x_train :train collection feature data\n- y_train :train collection object data\n- x_val :test collection feature data\n- y_val :test collection object data\n\nOUT\n- bst_param :the best parameter collection\n- bst_score :model performance under the best parameter collection and given test data\n\n## code example\n```python\nfrom sklearn.tree import DecisionTreeClassifier \nfrom sklearn.datasets import load_breast_cancer\nimport lightgrid\ndata = load_breast_cancer()\nx_train = data['data'][:400,:]\ny_train = data['target'][:400]\nx_val = data['data'][400:,:]\ny_val = data['target'][400:]\nDecisionTreeClassifier()\n\nparam_grid = {'max_depth':[10,20],\n 'min_samples_split':[2,4,6,8,10],\n 'min_samples_leaf':[1,3,5]\n }\nautograd = lightgrid.lightgrid(DecisionTreeClassifier,param_grid,valid_times=1,save_model=False)\nautograd.fit(x_train=x_train,y_train=y_train,x_val=x_val,y_val=y_val)\nprint('the best param is '+str(autograd.bst_param))\nprint('the best score is '+str(autograd.bst_score))\n```\n\n## Algorithm Performance \n\nUnder 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 calculation\n\nAll tests are run on a 12 core (hyperthreaded) Intel(R) Xeon(R) CPU E5-2678 v3.\n\n|Data Set | Target | lightgrid Time| gridSearchCV Time |lightgrid score|gridSearchCV score|\n| ------- | ------ | -----------| ---- | ---- | ---- | \n|[breast_cancer](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_breast_cancer.html) |0-1|0.76817s | 1.93696s | 0.91420| 0.89940 |\n|[digits](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_digits.html#sklearn.datasets.load_digits)|0-9| 1.50722s | 3.25618s | 0.77365 | 0.7728 |\n|[wine](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_wine.html#sklearn.datasets.load_wine)|0-3| 0.11532s | 0.50491s | 0.38461 | 0.30769 |\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Fast model parameter adjustment tool Using evolutionary thinking",
"version": "4.1.0",
"split_keywords": [
"light",
"grid",
"gridsearch",
"param",
"parameter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cb0cc224db64672629045bf467cba956d45cbf4719ef0633a546942a3199319a",
"md5": "d66648b3740caefee094fc8502dc852b",
"sha256": "f8bdc5be920ff7c8595f7df0dcee54b0952732ef7d00cbbc8459a07d7b736d92"
},
"downloads": -1,
"filename": "lightgrid-4.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d66648b3740caefee094fc8502dc852b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 5721,
"upload_time": "2023-03-22T07:20:39",
"upload_time_iso_8601": "2023-03-22T07:20:39.581222Z",
"url": "https://files.pythonhosted.org/packages/cb/0c/c224db64672629045bf467cba956d45cbf4719ef0633a546942a3199319a/lightgrid-4.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-22 07:20:39",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "lightgrid"
}