{"id":22437664,"url":"https://github.com/justinlovinger/optimal-py-learning","last_synced_at":"2025-08-01T15:32:22.223Z","repository":{"id":86688357,"uuid":"103699876","full_name":"justinlovinger/optimal-py-learning","owner":"justinlovinger","description":"Python machine learning library using powerful numerical optimization methods.","archived":false,"fork":false,"pushed_at":"2021-07-31T18:32:00.000Z","size":911,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T02:22:37.747Z","etag":null,"topics":["bfgs","ensemble-learning","gradient-descent","l-bfgs","linear-regression","machine-learning","mlp","multilayer-perceptron","neural-network","optimization","python","rbf-network","regression","self-organizing-map","som","supervised-learning"],"latest_commit_sha":null,"homepage":"","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/justinlovinger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2017-09-15T20:46:54.000Z","updated_at":"2023-08-21T17:17:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"43b33cab-8fa7-47b9-90e7-890e2cd5a3cb","html_url":"https://github.com/justinlovinger/optimal-py-learning","commit_stats":null,"previous_names":["justinlovinger/optimal-py-learning","justinlovinger/learning"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/justinlovinger/optimal-py-learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlovinger%2Foptimal-py-learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlovinger%2Foptimal-py-learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlovinger%2Foptimal-py-learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlovinger%2Foptimal-py-learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinlovinger","download_url":"https://codeload.github.com/justinlovinger/optimal-py-learning/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlovinger%2Foptimal-py-learning/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268250781,"owners_count":24219941,"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-01T02:00:08.611Z","response_time":67,"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":["bfgs","ensemble-learning","gradient-descent","l-bfgs","linear-regression","machine-learning","mlp","multilayer-perceptron","neural-network","optimization","python","rbf-network","regression","self-organizing-map","som","supervised-learning"],"created_at":"2024-12-06T00:13:45.644Z","updated_at":"2025-08-01T15:32:21.771Z","avatar_url":"https://github.com/justinlovinger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Learning (beta)\nA python machine learning library, with powerful customization for advanced users, and robust default options for quick implementation.\n\nWarning: Learning is in beta. API may change. Breaking changes may be noted in this readme, but no guarantee is given.\n\nCurrently supported models:\n\n* Multilayer perceptron (MLP). Commonly known as a neural network.\n* Linear and logistic regression, including Ridge and Lasso.\n* Radial basis function network (RBF)\n* Probabilistic neural network (PBNN)\n* Self organizing map (SOM)\n* Bagger ensemble\n\nNumerical optimization strategies are also implemented to optimize models:\n\n* Steepest descent\n* Steepest descent with momentum\n* Broyden–Fletcher–Goldfarb-Shanno (BFGS)\n* Limited-memory Broyden–Fletcher–Goldfarb-Shanno (L-BFGS)\n* Backtracking line search\n* Wolfe line search\n* First order change initial step\n* Quadratic initial step\n\n# Installation\n    Copy the \"learning\" folder to [python-path]/lib/site-packages\n\n# Usage\n```python\nfrom learning import datasets, validation, MLP\nfrom learning import SoftmaxTransfer  # To further customize our MLP\nfrom learning import CrossEntropyError  # To customize the error function of our MLP\nfrom learning import optimize  # To customize the training of our MLP\n\n# Grab the popular iris dataset, from our library of datasets\ndataset = datasets.get_iris()\n\n# Make a multilayer perceptron to classify the iris dataset\nmodel = MLP(\n    # The MLP will take 4 attributes, have 1 hidden layer with 2 neurons,\n    # and outputs one of 3 classes\n    (4, 2, 3),\n\n    # We will use a softmax output layer for this classification problem\n    # Because we are only changing the output transfer, we pass a single\n    # Transfer object. We could customize all transfer layers by passing\n    # a list of Transfer objects.\n    transfers=SoftmaxTransfer(),\n\n    # Cross entropy error will pair nicely with our softmax output.\n    error_func=CrossEntropyError(),\n\n    # Lets use the quasi-newton BFGS optimizer for this problem\n    # BFGS requires and n^2 operation, where n is the number of weights,\n    # but this isn't a problem for our relatively small MLP.\n    # If we don't want to deal with optimizers, the default\n    # option will select an appropriate optimizer for us.\n    optimizer=optimize.BFGS(\n        # We can even customize the line search method\n        step_size_getter=optimize.WolfeLineSearch(\n            # And the initial step size for our line search\n            initial_step_getter=optimize.FOChangeInitialStep())))\n\n# NOTE: For rapid prototyping, we could quickly implement an MLP as follows\n# model = MLP((4, 2, 3))\n\n# Lets train our MLP\n# First, we'll split our dataset into training and testing sets\n# Our training set will contain 30 samples from each class\ntraining_set, testing_set = validation.make_train_test_sets(\n    *dataset, train_per_class=30)\n\n# We could customize training and stopping criteria through\n# the arguments of train, but the defaults should be sufficient here\nmodel.train(*training_set)\n\n# Our MLP should converge in a couple of seconds\n# Lets see how our MLP does on the testing set\nprint 'Testing accuracy:', validation.get_accuracy(model, *testing_set)\n```\n\nFor further usage details, see comprehensive doc strings for public functions and classes.\n\n# Breaking Changes\n## 03/28/2018\nIn RBF, replace pre\\_train\\_clusters with cluster\\_incrementally.\nWhen True, clusters are trained once before output is trained.\nWhen False, cluster are trained incrementally alongside output.\nThis defaults to True, when previously, pre\\_train\\_clusters defaulted to False.\n\n## 03/28/2018\nRBF takes clustering\\_model instead of SOM hyperparameters.\n\n## 03/28/2018\nChange \\_pre\\_train and \\_post\\_train callbacks to take training dataset.\n\n## 10/27/2017\nMove Model.train pattern\\_select\\_func functionality to new Model.stochastic\\_train method.\nThis improves compatibility with optimizers, by ensuring the optimizer is reset before pattern selection changes the optimization problem.\n\nAlso remove base.select_iterative function, because it no longer serves a purpose.\n\n## 10/16/2017\nRename error functions, so that they end with Error, for greater clarity.\n\n## 10/16/2017\nRename Model.test -\u003e Model.print_results","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinlovinger%2Foptimal-py-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinlovinger%2Foptimal-py-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinlovinger%2Foptimal-py-learning/lists"}