{"id":24538032,"url":"https://github.com/ginberg/spark-sklearn","last_synced_at":"2025-07-09T07:04:44.716Z","repository":{"id":79355290,"uuid":"72264297","full_name":"ginberg/spark-sklearn","owner":"ginberg","description":null,"archived":false,"fork":false,"pushed_at":"2016-10-29T04:31:30.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T07:02:44.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ginberg.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-29T04:11:26.000Z","updated_at":"2016-10-29T04:20:31.000Z","dependencies_parsed_at":"2023-03-24T04:33:15.196Z","dependency_job_id":null,"html_url":"https://github.com/ginberg/spark-sklearn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ginberg/spark-sklearn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginberg%2Fspark-sklearn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginberg%2Fspark-sklearn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginberg%2Fspark-sklearn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginberg%2Fspark-sklearn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ginberg","download_url":"https://codeload.github.com/ginberg/spark-sklearn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginberg%2Fspark-sklearn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264411125,"owners_count":23603799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T14:14:44.567Z","updated_at":"2025-07-09T07:04:44.710Z","avatar_url":"https://github.com/ginberg.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Parallelized GridSearchCV in Apache Spark with StratifiedShuffleSplit\n\nI have run into an issue with using https://github.com/databricks/spark-sklearn with a StratifiedShuffleSplit cross validator. Therefore I have created this class.\n\n\n### Use case\n\nIt focuses on problems that have a small amount of data and that can be run in parallel.\n- for small datasets, it distributes the search for estimator parameters (`GridSearchCV` in scikit-learn), using Spark,\n- for datasets that do not fit in memory, I recommend using the [distributed implementation in Spark ML](https://spark.apache.org/docs/latest/api/python/pyspark.ml.html).\n- StratifiedShuffleSplit is used as cross validator, this makes sure that every fold preserves the percentage of samples for each class and these folds are randomized. \n\n### Example\n\n```python\nfrom sklearn import svm, grid_search, datasets\nfrom sklearn.model_selection import StratifiedShuffleSplit\nfrom spark_gridsearch import GridSearchCVSSS\niris = datasets.load_iris()\n\nparameters = {'kernel':('linear', 'rbf'), 'C':[1, 10]}\n\nsvr = svm.SVC()\nsss = StratifiedShuffleSplit(n_splits=10, test_size=0.5)\n\n# first argument (sc) is the sparkContext, this should be available. You might need to import it yourself. \n# I used it with jupyter notebook and pyspark where I don't need to import it in the notebook itself.\nclf = GridSearchCVSSS(sc, svr, parameters, cv=sss)\nclf.fit(iris.data, iris.target)\n```\n\n## License\n\nThis package is released under the Apache 2.0 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fginberg%2Fspark-sklearn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fginberg%2Fspark-sklearn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fginberg%2Fspark-sklearn/lists"}