{"id":32204211,"url":"https://github.com/statcompute/yap","last_synced_at":"2025-10-22T04:52:20.475Z","repository":{"id":56935500,"uuid":"225076343","full_name":"statcompute/yap","owner":"statcompute","description":"Yet Another Probabilistic Neural Network ","archived":false,"fork":false,"pushed_at":"2020-10-25T20:30:16.000Z","size":428,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T04:52:13.900Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statcompute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-30T22:14:12.000Z","updated_at":"2020-10-25T20:30:18.000Z","dependencies_parsed_at":"2022-08-21T01:10:11.078Z","dependency_job_id":null,"html_url":"https://github.com/statcompute/yap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/statcompute/yap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fyap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fyap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fyap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fyap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statcompute","download_url":"https://codeload.github.com/statcompute/yap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statcompute%2Fyap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382995,"owners_count":26321423,"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-22T02:00:06.515Z","response_time":63,"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-10-22T04:52:19.686Z","updated_at":"2025-10-22T04:52:20.470Z","avatar_url":"https://github.com/statcompute.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"150\" height=\"100\" src=\"https://github.com/statcompute/yap/blob/master/code/yap.jpg\"\u003e\n\u003c/p\u003e\n\n### \u003cp align=\"center\"\u003e Yet Another Probabilistic (YAP) \u003c/p\u003e\n### \u003cp align=\"center\"\u003e  Neural Network \u003c/p\u003e\n\n#### Introduction\n\nYAP is a R package implementing [Probabilistic Neural Networks (Specht, 1990)](http://courses.cs.tamu.edu/rgutier/cpsc636_s10/specht1990pnn.pdf) that can be employed in N-category pattern recognition with N \u003e 2.\n\nSimilar to General Regression Neural Networks (GRNN), PNN shares same benefits of instantaneous training, simple structure, and global convergence. \n\n#### Package Dependencies\nR version 3.6, base, stats, parallel, randtoolbox, and lhs\n\n#### Installation\n\nDownload the [yap_0.1.0.tar.gz](https://github.com/statcompute/yap/blob/master/yap_0.1.0.tar.gz) file, save it in your working directory, and then install the package as below.\n\n```r\ninstall.packages(\"yap_0.1.0.tar.gz\", repos = NULL, type = \"source\")\n```\n\n#### Functions\n\n```txt\nYAP \n  |\n  |-- Utility Functions\n  |     |-- dummies(x)\n  |     |-- folds(idx, n, seed = 1)\n  |     |-- logl(y_true, y_pred)\n  |     |-- gen_unifm(min = 0, max = 1, n, seed = 1)\n  |     |-- gen_sobol(min = 0, max = 1, n, seed = 1)   \n  |     `-- gen_latin(min = 0, max = 1, n, seed = 1) \n  |\n  |-- Training\n  |     `-- pnn.fit(x, y, sigma = 1) \n  |\n  |-- Prediction\n  |     |-- pnn.predone(net, x) \n  |     |-- pnn.predict(net, x)  \n  |     `-- pnn.parpred(net, x)  \n  |\n  |-- Parameter Tuning\n  |     |-- pnn.search_logl(net, sigmas, nfolds = 4, seed = 1) \n  |     `-- pnn.optmiz_logl(net, lower = 0, upper, nfolds = 4, seed = 1, method = 1)\n  |\n  `-- Variable Importance\n        |-- pnn.x_imp(net, i) \n        |-- pnn.imp(net)\n        |-- pnn.x_pfi(net, i, ntry = 1e3, seed = 1)\n        `-- pnn.pfi(net, ntry = 1e3, seed = 1)\n  \n```\n#### Example\n\nBelow is a demonstration showing how to use the YAP package and a comparison between the multinomial regression and the PNN. As shown below, both approaches delivered very comparable predictive performance. In this particular example, PNN even performed slightly better in terms of the cross-entropy for a separate testing dataset. \n\n```R\ndata(\"Heating\", package = \"mlogit\")\nY \u003c- Heating[, 2]\nX \u003c- scale(Heating[, 3:15])\nidx \u003c- with(set.seed(1), sample(seq(nrow(X)), nrow(X) / 2))\n \n### FIT A MULTINOMIAL REGRESSION AS A BENCHMARK ###\nm1 \u003c- nnet::multinom(Y ~ ., data = data.frame(X, Y)[idx, ], model = TRUE)\n# cross-entropy for the testing set\nyap::logl(y_pred = predict(m1, newdata = X, type = \"prob\")[-idx, ], y_true = yap::dummies(Y)[-idx, ])\n# 1.182727\n \n### FIT A PNN ###\nn1 \u003c- yap::pnn.fit(x = X[idx, ], y = Y[idx])\nparm \u003c- yap::pnn.search_logl(n1, yap::gen_latin(1, 10, 20), nfolds = 5)\nn2 \u003c- yap::pnn.fit(X[idx, ], Y[idx], sigma = parm$best$sigma)\n# cross-entropy for the testing set\nyap::logl(y_pred = yap::pnn.predict(n2, X)[-idx, ], y_true = yap::dummies(Y)[-idx, ])\n# 1.148456\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatcompute%2Fyap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatcompute%2Fyap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatcompute%2Fyap/lists"}