{"id":18402852,"url":"https://github.com/jancervenka/net","last_synced_at":"2025-10-07T03:44:56.392Z","repository":{"id":94373978,"uuid":"262852183","full_name":"jancervenka/net","owner":"jancervenka","description":"Neural network classifier implemented in Eigen","archived":false,"fork":false,"pushed_at":"2020-07-14T05:36:57.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T19:19:25.102Z","etag":null,"topics":["cpp","eigen","neural-network"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/jancervenka.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":"2020-05-10T18:40:04.000Z","updated_at":"2020-07-14T05:36:59.000Z","dependencies_parsed_at":"2023-04-19T04:57:33.484Z","dependency_job_id":null,"html_url":"https://github.com/jancervenka/net","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jancervenka/net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancervenka%2Fnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancervenka%2Fnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancervenka%2Fnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancervenka%2Fnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jancervenka","download_url":"https://codeload.github.com/jancervenka/net/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jancervenka%2Fnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278717439,"owners_count":26033542,"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-10-07T02:00:06.786Z","response_time":59,"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":["cpp","eigen","neural-network"],"created_at":"2024-11-06T02:43:44.352Z","updated_at":"2025-10-07T03:44:56.377Z","avatar_url":"https://github.com/jancervenka.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[0]: http://eigen.tuxfamily.org/index.php?title=Main_Page\n[1]: https://cs231n.github.io/neural-networks-case-study/\n\n# Net\n\nNeural network classifier implemented in C++ and [Eigen numeric library][0].\nThe code is based on the [Python example][1] from Stanford CS231.\n\nThe classifer is using softmax and L2 regularization to compute the loss.\nTraining is done with vanilla gradient descent. The network architecture\nconsists of one hidden layer with RELU activations.\n\n## Usage\n\nThe `Net` constructor requires number of features and classes in\nthe classification problem and size of the network hidden layer.\n\n```cpp\nNet(int n_features, int n_classes, int hidden_size);\n```\n\nTraining a model requires a `MatrixXd` feature matrix, `VectorXi`\ntarget labels and number of epochs.\n\n```cpp\nvoid fit(const Eigen::MatrixXd \u0026X, const Eigen::VectorXi \u0026y, int epochs);\n```\n\nClassifying new samples requires a `MatrixXd` feature matrix.\nThe output is a matrix with class probabilites for each sample.\n\n```cpp\nEigen::MatrixXd predict(const Eigen::MatrixXd \u0026X);\n```\n\n### Example\n\n```cpp\nint main() {\n\n    Eigen::MatrixXd X_train = load_X_train();\n    Eigen::VectorXi y_train = load_y_train();\n    Eigen::MatrixXd X = load_X();\n    int epochs = 100;\n\n    Net nn(2, 2, 64);\n    nn.fit(X_train, y_train, epochs);\n\n    Eigen::VectorXi y_pred = nn.predict(X);\n}\n```\n\nA working example can be found in `example/main.cpp`. On OS X, it can be built by\nrunning `make` (assuming `Eigen` is in `/usr/local/include`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancervenka%2Fnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjancervenka%2Fnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancervenka%2Fnet/lists"}