{"id":13869948,"url":"https://github.com/RainingComputers/pykitml","last_synced_at":"2025-07-15T18:32:34.772Z","repository":{"id":36662019,"uuid":"225810165","full_name":"RainingComputers/pykitml","owner":"RainingComputers","description":"Machine Learning library written in Python and NumPy.","archived":false,"fork":false,"pushed_at":"2022-12-27T16:39:49.000Z","size":1094,"stargazers_count":27,"open_issues_count":3,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T08:48:39.831Z","etag":null,"topics":["deep-learning","machine-learning","neural-network","numpy","python-library","random-forest"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RainingComputers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-04T07:52:45.000Z","updated_at":"2024-09-15T04:03:36.000Z","dependencies_parsed_at":"2023-01-17T04:01:03.667Z","dependency_job_id":null,"html_url":"https://github.com/RainingComputers/pykitml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RainingComputers%2Fpykitml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RainingComputers%2Fpykitml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RainingComputers%2Fpykitml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RainingComputers%2Fpykitml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RainingComputers","download_url":"https://codeload.github.com/RainingComputers/pykitml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226063144,"owners_count":17567956,"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":["deep-learning","machine-learning","neural-network","numpy","python-library","random-forest"],"created_at":"2024-08-05T20:01:22.873Z","updated_at":"2024-11-23T15:32:22.094Z","avatar_url":"https://github.com/RainingComputers.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![pykitml logo](https://raw.githubusercontent.com/RainingComputers/pykitml/master/pykitml128.png)\n\n# pykitml (Python Kit for Machine Learning)\nMachine Learning library written in Python and NumPy.\n\n### Installation\n\n```\npython3 -m pip install pykitml\n```\n\n### Documentation\n\nhttps://pykitml.readthedocs.io/en/latest/\n\n# Demo (MNIST)\n### Training\n``` python\nimport os.path\n\nimport numpy as np\nimport pykitml as pk\nfrom pykitml.datasets import mnist\n    \n# Download dataset\nif(not os.path.exists('mnist.pkl')): mnist.get()\n\n# Load dataset\ntraining_data, training_targets, testing_data, testing_targets = mnist.load()\n    \n# Create a new neural network\ndigit_classifier = pk.NeuralNetwork([784, 100, 10])\n    \n# Train it\ndigit_classifier.train(\n    training_data=training_data,\n    targets=training_targets, \n    batch_size=50, \n    epochs=1200, \n    optimizer=pk.Adam(learning_rate=0.012, decay_rate=0.95), \n    testing_data=testing_data, \n    testing_targets=testing_targets,\n    testing_freq=30,\n    decay_freq=15\n)\n    \n# Save it\npk.save(digit_classifier, 'digit_classifier_network.pkl')\n\n# Show performance\naccuracy = digit_classifier.accuracy(training_data, training_targets)\nprint('Train Accuracy:', accuracy)        \naccuracy = digit_classifier.accuracy(testing_data, testing_targets)\nprint('Test Accuracy:', accuracy)\n    \n# Plot performance graph\ndigit_classifier.plot_performance()\n\n# Show confusion matrix\ndigit_classifier.confusion_matrix(training_data, training_targets)\n```\n\n### Trying the model\n```python\nimport random\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport pykitml as pk\nfrom pykitml.datasets import mnist\n\n# Load dataset\ntraining_data, training_targets, testing_data, testing_targets = mnist.load()\n\n# Load the trained network\ndigit_classifier = pk.load('digit_classifier_network.pkl')\n\n# Pick a random example from testing data\nindex = random.randint(0, 9999)\n\n# Show the test data and the label\nplt.imshow(training_data[index].reshape(28, 28))\nplt.show()\nprint('Label: ', training_targets[index])\n\n# Show prediction\ndigit_classifier.feed(training_data[index])\nmodel_output = digit_classifier.get_output_onehot()\nprint('Predicted: ', model_output)\n```\n\n### Performance Graph\n\n![Performance Graph](https://raw.githubusercontent.com/RainingComputers/pykitml/master/docs/demo_pics/neural_network_perf_graph.png)\n\n### Confusion Matrix\n\n![Confusion Matrix](https://raw.githubusercontent.com/RainingComputers/pykitml/master/docs/demo_pics/neural_network_confusion_matrix.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRainingComputers%2Fpykitml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRainingComputers%2Fpykitml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRainingComputers%2Fpykitml/lists"}