{"id":24912859,"url":"https://github.com/raynardj/ray","last_synced_at":"2025-08-20T18:10:33.966Z","repository":{"id":97434725,"uuid":"107849817","full_name":"raynardj/ray","owner":"raynardj","description":"Hacks \u0026 Tools for machine learning","archived":false,"fork":false,"pushed_at":"2019-01-21T15:48:39.000Z","size":206,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-24T12:50:33.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://raynardj.github.io/ray/","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/raynardj.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,"zenodo":null}},"created_at":"2017-10-22T08:36:26.000Z","updated_at":"2024-06-01T06:16:26.000Z","dependencies_parsed_at":"2023-03-13T16:13:54.755Z","dependency_job_id":null,"html_url":"https://github.com/raynardj/ray","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raynardj/ray","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raynardj%2Fray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raynardj%2Fray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raynardj%2Fray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raynardj%2Fray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raynardj","download_url":"https://codeload.github.com/raynardj/ray/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raynardj%2Fray/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271362128,"owners_count":24746496,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-02-02T05:28:46.338Z","updated_at":"2025-08-20T18:10:33.920Z","avatar_url":"https://github.com/raynardj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hacks and Tools on machine learning\n\n## matchbox.py\n\nA tool box for pytorch, A wrapper around trainer\n\nFull introduction [here](https://raynardj.github.io/ray/docs/matchbox)\n\n## kmean_torch.py\n\nThe core class for cuda accelerated kmeans by batch\n\nFull introduction [here](https://raynardj.github.io/ray/docs/kmean_torch)\n\n## lprint.py\n\nA program to print log in a very neat format\n````python\nfrom ray import lprint\nl=lprint.lprint(\"newtask\")\n\n# Do something time consuming\nl.p(\"data loaded\",\"data avatar images loaded\")\n\n# or you can just pass one string\nl.p(\"data processed\")\n````\n\n## bcolzer.py\n\nTurns big bulk array to bcolz file.\n\nFor a numpy, if you create some thing big, like a.shape=(1000000,224,224,3)\n\nYou memory won't indulge this simplicity. With bcolz, you can flush array to hard drive, and still use bcolz array as a single variable.\n\n````python\nfrom ray import bcolzer\nbzr=bcolzer.bcolzer(\"img\")\n# create an image generator, use bzr.gen as the generator\nbzr.img_gen(\"/dir_to_your_img_folder\",with_class=True)\n\nbzr.empety_img_bcolz(\"/dir_to_your_img_bcolz\",\"/dir_to_your_label_bcolz\")\n````\n\n## metrics.py\n\nAugmented metrics for keras\n\nAdded ```ratio```,```precision``` and ```recall```\n\nThis will calculate the ratio,precision and recall of a specific category for classification problem.\n\n````python\nfrom ray.metrics import precision\n\n# Precision is the fraction of detections\n# reported by the model that were correct.\n\ndef dog_precision(y_true,y_pred):\n    # assuming dog is your second category\n    return precision(1,y_true,y_pred)\n\n# while compiling a keras model\nmodel.compile(loss='categorical cross',metrics=[\"accuracy\",dog_precision],optimizer=\"Adam\")\n````\n\n## armory.py\n\n### preproc\n\nPreprocess before entering the cnn/resnet\n\nNotice: it does not scale element to ````[0,1]````\n\n### check_img_folder_multi\n\ncheck img folder with multi processing\n```python\ncheck_img_folder_multi('/data/cats/img/')\n```\n### folder_split\n\nSplit folder to train/valid\n\n```python\nfrom ray.armory import folder_split\n\n# The path we input contains sub-folders(categories)\n\nfolder_split(\"/data/animals\",percent=.8)\n\n# percent : the percentage of train data\n\n```\n### one_hot\n\nTurn index array to one hot encoded array\n\n```python\n\nfrom ray.armory import one_hot\n\n# say if we have a array which labels 5 classes\none_hot(label_array, num_classes=5)\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraynardj%2Fray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraynardj%2Fray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraynardj%2Fray/lists"}