[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-nikolaypavlov--MLPNeuralNet":3,"tool-nikolaypavlov--MLPNeuralNet":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",160784,2,"2026-04-19T11:32:54",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,"2026-04-18T11:18:24",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":76,"owner_website":78,"owner_url":79,"languages":80,"stars":89,"forks":90,"last_commit_at":91,"license":92,"difficulty_score":32,"env_os":93,"env_gpu":94,"env_ram":95,"env_deps":96,"category_tags":103,"github_topics":76,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":104,"updated_at":105,"faqs":106,"releases":136},9647,"nikolaypavlov\u002FMLPNeuralNet","MLPNeuralNet","Fast multilayer perceptron neural network library for iOS and Mac OS X","MLPNeuralNet 是一款专为 iOS 和 Mac OS X 平台打造的高性能多层感知机（神经网络）库。它的核心使命是解决机器学习模型从训练环境到移动端部署的“最后一公里”难题：当开发者在 Matlab、Python 或 R 中训练好模型后，可以通过它轻松将模型集成到苹果生态的应用中，仅用于高效的前向预测推理。\n\n这款工具特别适合需要在移动端实现分类、多类别判断或回归功能的 iOS\u002FmacOS 开发者，以及希望验证算法落地效果的研究人员。其独特的技术亮点在于底层基于 Apple Accelerate 框架构建，充分利用矢量运算和硬件加速能力，确保了极快的运行速度。同时，它支持双精度计算，允许灵活配置多个隐藏层，并能兼容来自 PyBrain 等外部工具训练的权重数据。只需传入网络结构和权重参数，MLPNeuralNet 即可快速对新样本进行预测，是让复杂算法在移动设备上流畅运行的得力助手。","#MLPNeuralNet\n[![Build Status](https:\u002F\u002Ftravis-ci.org\u002Fnikolaypavlov\u002FMLPNeuralNet.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fnikolaypavlov\u002FMLPNeuralNet)\n[![Join the chat at https:\u002F\u002Fgitter.im\u002Fnikolaypavlov\u002FMLPNeuralNet](https:\u002F\u002Fbadges.gitter.im\u002FJoin%20Chat.svg)](https:\u002F\u002Fgitter.im\u002Fnikolaypavlov\u002FMLPNeuralNet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n`MLPNeuralNet` is a fast [multilayer perceptron](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMultilayer_perceptron) neural network library for iOS and Mac OS X. `MLPNeuralNet` predicts new examples through trained neural networks. It is built on top of Apple's [Accelerate Framework](https:\u002F\u002Fdeveloper.apple.com\u002Flibrary\u002Fios\u002Fdocumentation\u002FAccelerate\u002FReference\u002FAccelerateFWRef\u002F_index.html) using vectored operations and hardware acceleration (if available).\n\n![Neural Network](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_readme_4215897f3cb1.png)\n\n##Why would you use it?\nImagine that you have engineered a prediction model using Matlab (Python or R) and would like to use it in an iOS application. If that's the case, `MLPNeuralNet` is exactly what you need. `MLPNeuralNet` is designed to load and run models in [forward propagation](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBackpropagation#Phase_1:_Propagation) mode only.\n\n###Features\n- [Classification](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBinary_classification), [Multi-class classification](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMulticlass_classification) and regression output\n- Vectorised implementation\n- Works with double precision\n- Multiple hidden layers or none (in that case it's same as logistic\u002Flinear regression)\n\n##Quick Example\nLet's deploy a model for the AND function  ([conjunction](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLogical_conjunction)) that works as follows: (of course, you do not need to use a neural network for this in the real world)\n\n|X1 |X2 | Y |\n|:-:|:-:|:-:|\n| 0 | 0 | 0 |\n| 1 | 0 | 0 |\n| 0 | 1 | 0 |\n| 1 | 1 | 1 |\n\nOur model has the following weights and network configuration:\n\n![AND Model Example](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_readme_26ee532d6821.png)\n\n```objective\n\u002F\u002F Use the designated initialiser to pass the network configuration and weights to the model.\n\u002F\u002F Note: You do not need to specify the biased units (+1 above) in the configuration.\n\nNSArray *netConfig = @[@2, @1];\ndouble wts[] = {-30, 20, 20};\nNSData *weights = [NSData dataWithBytes:wts length:sizeof(wts)];\n\nMLPNeuralNet *model = [[MLPNeuralNet alloc] initWithLayerConfig:netConfig\n                                                        weights:weights\n                                                     outputMode:MLPClassification];\n\u002F\u002F Predict output of the model for new sample\ndouble sample[] = {0, 1};\nNSData * vector = [NSData dataWithBytes:sample length:sizeof(sample)];\nNSMutableData * prediction = [NSMutableData dataWithLength:sizeof(double)];\n[model predictByFeatureVector:vector intoPredictionVector:prediction];\n\ndouble * assessment = (double *)prediction.bytes;\nNSLog(@\"Model assessment is %f\", assessment[0]);\n```\n\n##Extended Example\nLet's say you trained a net using pybrain or even your own home brewed implementation.\n\n![Extended Example](http:\u002F\u002Fi.imgur.com\u002Fv2kMTUH.png)\n\n```objective\n\u002F\u002F Use the designated initialiser to pass the network configuration and weights to the model.\n\u002F\u002F Note: You do not need to specify the biased units (+1 above) in the configuration.\n\nNSArray *netConfig = @[@3, @2, @1];\ndouble wts[] = {b1, w1, w2, w3, b2, w4, w5, w6, b3, w7, w8};\nNSData *weights = [NSData dataWithBytes:wts length:sizeof(wts)];\n\nMLPNeuralNet *model = [[MLPNeuralNet alloc] initWithLayerConfig:netConfig\n                                                        weights:weights\n                                                     outputMode:MLPClassification];\nmodel.hiddenActivationFunction = MLPSigmoid;\nmodel.outputActivationFunction = MLPNone;\n\n\u002F\u002F Predict output of the model for new sample\ndouble sample[] = {0, 1, 2};\nNSData * vector = [NSData dataWithBytes:sample length:sizeof(sample)];\nNSMutableData * prediction = [NSMutableData dataWithLength:sizeof(double)];\n[model predictByFeatureVector:vector intoPredictionVector:prediction];\n\ndouble * assessment = (double *)prediction.bytes;\nNSLog(@\"Model assessment is %f\", assessment[0]);\n```\n\n##Getting Started\nThe following instructions describe how to setup and install `MLPNeuralNet` using [CocoaPods](http:\u002F\u002Fcocoapods.org\u002F). It is written for Xcode 5 and the iOS 7.x(+) SDK. If you are not familiar with CocoaPods, just clone the repository and import `MLPNeuralNet` directly as a subproject.\n\n##Installing through CocoaPods\nPlease add the following line to your *Podfile*.\n\n```\npod 'MLPNeuralNet', '~> 1.0.0'\n```\n\n##Installing through Carthage\nPlease add the following line to your *Cartfile*.\n\n```\ngithub \"nikolaypavlov\u002FMLPNeuralNet\" \"master\"\n```\n\n##Import `MLPNeuralNet.h`\nDo not forget to add the following line to the top of your model:\n```objectivec\n#import \"MLPNeuralNet.h\"\n```\n\n##How many weights do I need to initialise network X->Y->Z?\nMost of the popular libraries (including `MLPNeuralNet`) implicitly add biased units for each of the layers except the last one. Assuming these additional units, the total number of weights are `(X + 1) * Y + (Y + 1) * Z`.\n\n##Importing weights from other libs.\nYou can do this for *some* of the neural network packages available.\n\n###R nnet library:\n ```r\n#Assuming nnet_model is a trained neural network\nnnet_model$wts\n```\n\n###Python NeuroLab\n\n```python\n#Where net argument is an neurolab.core.Net object\nimport neurolab as nl\nimport numpy as np\n\ndef getweights(net):\n     vec = []\n     for layer in net.layers:\n         b = layer.np['b']\n         w = layer.np['w']\n         newvec = np.ravel(np.concatenate((b, np.ravel(w,order='F'))).reshape((layer.ci+1, layer.cn)), order = 'F')\n         [vec.append(nv) for nv in newvec]\n     return np.array(vec)\n\n```\n\n###Python neon\n```python\nimport numpy as np\n\ndef layer_names(params):\n    layer_names = params.keys()\n    layer_names.remove('epochs_complete')\n    # Sort layers by their appearance in the model architecture\n    # Since neon appands the index to the layer name we will use it to sort\n    layer_names.sort(key=lambda x: int(x.split(\"_\")[-1]))\n    return layer_names\n\ndef getweights(file_name):\n    vec = []\n    # Load a stored model file from disk (should have extension prm)\n    params = pkl.load(open(file_name, 'r'))\n    layers = layer_names(params)\n    \n    for layer in layers:\n        # Make sure our model has biases activated, otherwise add zeros here\n        b = params[layer]['biases']\n        w = params[layer]['weights']\n\n        newvec = np.ravel(np.hstack((b,w)))\n        [vec.append(nv) for nv in newvec]\n    return vec\n\n# An example call\ngetweights(expanduser('~\u002Fdata\u002Fworkout-dl\u002Fworkout-ep100.prm'))\n```\n\n###Python keras\n```python\nimport numpy as np\n\ndef get_weights_from_keras_model(model):\n    vec = np.array([])\n    for i in xrange(0, len(model.get_weights()), 2):\n        bias = model.get_weights()[i + 1]\n        weights_matrix = model.get_weights()[i]\n\n        newvec = np.ravel(np.concatenate((bias.reshape(-1, 1), weights_matrix.T), axis=1))\n        vec = np.append(vec, newvec)\n    return np.array(vec)\n\n```\n\n## Performance benchmarks\nIn this test, the neural network has grown layer by layer from a `1 -> 1` configuration to a `200 -> 200 -> 200 -> 1` configuration. At each step, the output is calculated and benchmarked using random input vectorisation and weights. Total number of weights grow from 2 to 80601 accordingly. I understand that the test is quite synthetic, but I hope it illustrates the performance. I will be happy if you can propose a better one! :)\n\n![MLPNeuralNet Performance Benchmark](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_readme_00401dd8305d.png)\n\n##Unit Testing\n`MLPNeuralNet` includes a diverse suite of unit tests in the `\u002FMLPNeuralNetTests` subdirectory. You can execute them using the ``MLPNeuralNet`` scheme within Xcode.\n\n##Acknowledgements\n`MLPNeuralNet` was inspired by:\n\n- [Andrew Ng's course on Machine Learning](https:\u002F\u002Fwww.coursera.org\u002Fcourse\u002Fml).\n- [Jeff Leek course on Data Analysis](https:\u002F\u002Fwww.coursera.org\u002Fcourse\u002Fdataanalysis).\n\nCredits:\n\n- Neural Network image was taken from [Wikipedia Commons](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FFile:Artificial_neural_network.svg).\n\n##Contact Me\nMaintainer: [Mykola Pavlov](http:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002F) (me@nikolaypavlov.com)\n\n**Please let me know on how you use `MLPNeuralNet` for some real world problems.**\n\n##Licensing\n`MLPNeuralNet` is released under the BSD license. See the LICENSE file for more information.\n","#MLPNeuralNet\n[![构建状态](https:\u002F\u002Ftravis-ci.org\u002Fnikolaypavlov\u002FMLPNeuralNet.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fnikolaypavlov\u002FMLPNeuralNet)\n[![加入聊天 https:\u002F\u002Fgitter.im\u002Fnikolaypavlov\u002FMLPNeuralNet](https:\u002F\u002Fbadges.gitter.im\u002FJoin%20Chat.svg)](https:\u002F\u002Fgitter.im\u002Fnikolaypavlov\u002FMLPNeuralNet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n`MLPNeuralNet` 是一个适用于 iOS 和 Mac OS X 的快速 [多层感知器](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMultilayer_perceptron) 神经网络库。`MLPNeuralNet` 通过训练好的神经网络对新样本进行预测。它基于 Apple 的 [Accelerate 框架](https:\u002F\u002Fdeveloper.apple.com\u002Flibrary\u002Fios\u002Fdocumentation\u002FAccelerate\u002FReference\u002FAccelerateFWRef\u002F_index.html)，利用向量化操作和硬件加速（如果可用）。\n\n![神经网络](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_readme_4215897f3cb1.png)\n\n##为什么使用它？\n假设你已经使用 Matlab（或 Python、R）设计了一个预测模型，并希望在 iOS 应用程序中使用它。如果是这样，`MLPNeuralNet` 正是你所需要的。`MLPNeuralNet` 专为仅以 [前向传播](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBackpropagation#Phase_1:_Propagation) 模式加载和运行模型而设计。\n\n###特性\n- 分类、多分类和回归输出\n- 向量化实现\n- 支持双精度运算\n- 多个隐藏层或无隐藏层（此时等同于逻辑回归或线性回归）\n\n##快速示例\n让我们部署一个用于 AND 函数（[合取](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FLogical_conjunction)）的模型，其工作方式如下：（当然，在实际应用中并不需要为此使用神经网络）\n\n|X1 |X2 | Y |\n|:-:|:-:|:-:|\n| 0 | 0 | 0 |\n| 1 | 0 | 0 |\n| 0 | 1 | 0 |\n| 1 | 1 | 1 |\n\n我们的模型具有以下权重和网络配置：\n\n![AND 模型示例](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_readme_26ee532d6821.png)\n\n```objective\n\u002F\u002F 使用指定的初始化方法将网络配置和权重传递给模型。\n\u002F\u002F 注意：您无需在配置中指定偏置单元（上述 +1）。\n\nNSArray *netConfig = @[@2, @1];\ndouble wts[] = {-30, 20, 20};\nNSData *weights = [NSData dataWithBytes:wts length:sizeof(wts)];\n\nMLPNeuralNet *model = [[MLPNeuralNet alloc] initWithLayerConfig:netConfig\n                                                        weights:weights\n                                                     outputMode:MLPClassification];\n\u002F\u002F 预测模型对新样本的输出\ndouble sample[] = {0, 1};\nNSData * vector = [NSData dataWithBytes:sample length:sizeof(sample)];\nNSMutableData * prediction = [NSMutableData dataWithLength:sizeof(double)];\n[model predictByFeatureVector:vector intoPredictionVector:prediction];\n\ndouble * assessment = (double *)prediction.bytes;\nNSLog(@\"模型评估结果为 %f\", assessment[0]);\n```\n\n##扩展示例\n假设你使用 pybrain 或甚至自己编写的实现训练了一个网络。\n\n![扩展示例](http:\u002F\u002Fi.imgur.com\u002Fv2kMTUH.png)\n\n```objective\n\u002F\u002F 使用指定的初始化方法将网络配置和权重传递给模型。\n\u002F\u002F 注意：您无需在配置中指定偏置单元（上述 +1）。\n\nNSArray *netConfig = @[@3, @2, @1];\ndouble wts[] = {b1, w1, w2, w3, b2, w4, w5, w6, b3, w7, w8};\nNSData *weights = [NSData dataWithBytes:wts length:sizeof(wts)];\n\nMLPNeuralNet *model = [[MLPNeuralNet alloc] initWithLayerConfig:netConfig\n                                                        weights:weights\n                                                     outputMode:MLPClassification];\nmodel.hiddenActivationFunction = MLPSigmoid;\nmodel.outputActivationFunction = MLPNone;\n\n\u002F\u002F 预测模型对新样本的输出\ndouble sample[] = {0, 1, 2};\nNSData * vector = [NSData dataWithBytes:sample length:sizeof(sample)];\nNSMutableData * prediction = [NSMutableData dataWithLength:sizeof(double)];\n[model predictByFeatureVector:vector intoPredictionVector:prediction];\n\ndouble * assessment = (double *)prediction.bytes;\nNSLog(@\"模型评估结果为 %f\", assessment[0]);\n```\n\n##开始使用\n以下说明描述了如何使用 [CocoaPods](http:\u002F\u002Fcocoapods.org\u002F) 设置和安装 `MLPNeuralNet`。本文档适用于 Xcode 5 和 iOS 7.x 及更高版本的 SDK。如果您不熟悉 CocoaPods，只需克隆仓库并将 `MLPNeuralNet` 直接作为子项目导入即可。\n\n##通过 CocoaPods 安装\n请将以下行添加到您的 *Podfile* 中。\n\n```\npod 'MLPNeuralNet', '~> 1.0.0'\n```\n\n##通过 Carthage 安装\n请将以下行添加到您的 *Cartfile* 中。\n\n```\ngithub \"nikolaypavlov\u002FMLPNeuralNet\" \"master\"\n```\n\n##导入 `MLPNeuralNet.h`\n别忘了在您的模型顶部添加以下行：\n```objectivec\n#import \"MLPNeuralNet.h\"\n```\n\n##我需要多少权重来初始化 X->Y->Z 网络？\n大多数流行的库（包括 `MLPNeuralNet`）都会隐式地为除最后一层以外的每一层添加偏置单元。假设包含这些额外的单元，总权重数量为 `(X + 1) * Y + (Y + 1) * Z`。\n\n##从其他库导入权重。\n您可以为*部分*可用的神经网络软件包执行此操作。\n\n###R nnet 库：\n ```r\n#假设 nnet_model 是一个训练好的神经网络\nnnet_model$wts\n```\n\n###Python NeuroLab\n\n```python\n#其中 net 参数是一个 neurolab.core.Net 对象\nimport neurolab as nl\nimport numpy as np\n\ndef getweights(net):\n     vec = []\n     for layer in net.layers:\n         b = layer.np['b']\n         w = layer.np['w']\n         newvec = np.ravel(np.concatenate((b, np.ravel(w,order='F'))).reshape((layer.ci+1, layer.cn)), order = 'F')\n         [vec.append(nv) for nv in newvec]\n     return np.array(vec)\n\n```\n\n###Python neon\n```python\nimport numpy as np\n\ndef layer_names(params):\n    layer_names = params.keys()\n    layer_names.remove('epochs_complete')\n    # 根据它们在模型架构中的出现顺序对层进行排序\n    # 由于 neon 将索引附加到层名称上，我们将使用该索引来排序\n    layer_names.sort(key=lambda x: int(x.split(\"_\")[-1]))\n    return layer_names\n\ndef getweights(file_name):\n    vec = []\n    # 从磁盘加载存储的模型文件（应具有 prm 扩展名）\n    params = pkl.load(open(file_name, 'r'))\n    layers = layer_names(params)\n    \n    for layer in layers:\n        # 确保我们的模型已激活偏置，否则在此处添加零\n        b = params[layer]['biases']\n        w = params[layer]['weights']\n\n        newvec = np.ravel(np.hstack((b,w)))\n        [vec.append(nv) for nv in newvec]\n    return vec\n\n# 一个调用示例\ngetweights(expanduser('~\u002Fdata\u002Fworkout-dl\u002Fworkout-ep100.prm'))\n```\n\n###Python keras\n```python\nimport numpy as np\n\ndef get_weights_from_keras_model(model):\n    vec = np.array([])\n    for i in range(0, len(model.get_weights()), 2):\n        bias = model.get_weights()[i + 1]\n        weights_matrix = model.get_weights()[i]\n\n        newvec = np.ravel(np.concatenate((bias.reshape(-1, 1), weights_matrix.T), axis=1))\n        vec = np.append(vec, newvec)\n    return np.array(vec)\n\n```\n\n## 性能基准测试\n在本次测试中，神经网络的结构逐层扩展，从 `1 -> 1` 的配置逐步增加到 `200 -> 200 -> 200 -> 1` 的配置。每一步都会使用随机输入向量和权重来计算输出并进行性能基准测试。因此，总权重数量也相应地从 2 增加到 80601。我明白这个测试相当理想化，但希望它能够说明性能情况。如果您能提出更好的测试方法，我将非常乐意接受！ :)\n\n![MLPNeuralNet 性能基准测试](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_readme_00401dd8305d.png)\n\n## 单元测试\n`MLPNeuralNet` 在 `\u002FMLPNeuralNetTests` 子目录中包含了一套多样化的单元测试。您可以在 Xcode 中使用 ``MLPNeuralNet`` 方案来运行这些测试。\n\n## 致谢\n`MLPNeuralNet` 的灵感来源于：\n\n- [Andrew Ng 的机器学习课程](https:\u002F\u002Fwww.coursera.org\u002Fcourse\u002Fml)。\n- [Jeff Leek 的数据分析课程](https:\u002F\u002Fwww.coursera.org\u002Fcourse\u002Fdataanalysis)。\n\n鸣谢：\n\n- 神经网络图片取自 [维基百科共享资源](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FFile:Artificial_neural_network.svg)。\n\n## 联系方式\n维护者：[Mykola Pavlov](http:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002F) (me@nikolaypavlov.com)\n\n**请告诉我您是如何将 `MLPNeuralNet` 应用于实际问题中的。**\n\n## 许可证\n`MLPNeuralNet` 采用 BSD 许可证发布。更多信息请参阅 LICENSE 文件。","# MLPNeuralNet 快速上手指南\n\nMLPNeuralNet 是一个专为 iOS 和 Mac OS X 设计的高性能多层感知机（MLP）神经网络库。它基于 Apple 的 Accelerate Framework 构建，利用矢量运算和硬件加速，非常适合将在 Matlab、Python 或 R 中训练好的模型部署到苹果生态应用中。\n\n> **注意**：该库仅支持**前向传播（预测）**模式，不支持在移动端进行模型训练。\n\n## 环境准备\n\n*   **操作系统**：macOS (开发环境)\n*   **目标平台**：iOS 7.0+ 或 macOS 10.9+\n*   **开发工具**：Xcode 5 或更高版本\n*   **依赖框架**：Apple Accelerate Framework (系统自带，无需额外安装)\n*   **语言支持**：Objective-C (可通过桥接头文件在 Swift 中使用)\n\n## 安装步骤\n\n你可以通过 CocoaPods 或 Carthage 进行安装，也可以直接作为子项目导入。\n\n### 方式一：使用 CocoaPods（推荐）\n\n在项目的 `Podfile` 中添加以下内容：\n\n```ruby\npod 'MLPNeuralNet', '~> 1.0.0'\n```\n\n然后在终端执行：\n\n```bash\npod install\n```\n\n### 方式二：使用 Carthage\n\n在项目的 `Cartfile` 中添加以下内容：\n\n```text\ngithub \"nikolaypavlov\u002FMLPNeuralNet\" \"master\"\n```\n\n然后在终端执行：\n\n```bash\ncarthage update --platform iOS\n```\n\n### 方式三：手动导入\n\n如果不熟悉上述工具，可以直接克隆仓库并将 `MLPNeuralNet` 文件夹拖入 Xcode 项目中作为子项目。\n\n无论采用哪种方式，请确保在使用前导入头文件：\n\n```objectivec\n#import \"MLPNeuralNet.h\"\n```\n\n## 基本使用\n\n以下示例演示如何加载一个预训练的“与门 (AND)\"逻辑模型并进行预测。\n\n### 1. 配置网络与权重\n假设你的网络结构为 `2 个输入节点 -> 1 个输出节点`。\n*   **网络配置**：`@[@2, @1]` (无需包含偏置单元)。\n*   **权重数据**：需按照 `(上一层节点数 + 1) * 当前层节点数` 的顺序排列（包含偏置权重）。\n\n### 2. 代码示例\n\n```objective-c\n\u002F\u002F 1. 定义网络层级配置 (输入层 2 节点，输出层 1 节点)\nNSArray *netConfig = @[@2, @1];\n\n\u002F\u002F 2. 定义权重数组 (包含偏置项 b=-30, 权重 w1=20, w2=20)\ndouble wts[] = {-30, 20, 20};\nNSData *weights = [NSData dataWithBytes:wts length:sizeof(wts)];\n\n\u002F\u002F 3. 初始化模型\n\u002F\u002F outputMode 可选：MLPClassification (分类), MLPRegression (回归)\nMLPNeuralNet *model = [[MLPNeuralNet alloc] initWithLayerConfig:netConfig\n                                                        weights:weights\n                                                     outputMode:MLPClassification];\n\n\u002F\u002F 4. 准备输入样本 (例如：0 和 1)\ndouble sample[] = {0, 1};\nNSData *vector = [NSData dataWithBytes:sample length:sizeof(sample)];\n\n\u002F\u002F 5. 创建用于接收预测结果的缓冲区\nNSMutableData *prediction = [NSMutableData dataWithLength:sizeof(double)];\n\n\u002F\u002F 6. 执行预测\n[model predictByFeatureVector:vector intoPredictionVector:prediction];\n\n\u002F\u002F 7. 获取结果\ndouble *assessment = (double *)prediction.bytes;\nNSLog(@\"Model assessment is %f\", assessment[0]);\n```\n\n### 关于权重数量的计算\n如果你的网络结构为 `X -> Y -> Z`，由于库会自动为除最后一层外的每层添加偏置单元，你需要初始化的权重总数为：\n`(X + 1) * Y + (Y + 1) * Z`\n\n你可以从 Python (Keras, Neurolab, Neon) 或 R (nnet) 等训练框架中提取权重并转换为上述格式传入。","某医疗科技团队开发了一款 iOS 端心脏病风险预测应用，需在手机端实时运行由 Python 训练好的复杂神经网络模型。\n\n### 没有 MLPNeuralNet 时\n- 无法直接在 iOS 原生环境中加载外部训练模型，必须将核心算法重写为 Objective-C 或 Swift 代码，极易引入逻辑误差。\n- 依赖云端 API 进行推理导致网络延迟高，患者在无网环境下无法使用，且频繁请求增加了服务器成本。\n- 缺乏针对 Apple 硬件的底层优化，纯软件模拟计算耗时严重，导致界面卡顿甚至应用崩溃。\n- 模型更新流程繁琐，每次调整参数都需要重新编译整个 App 并等待漫长的审核周期。\n\n### 使用 MLPNeuralNet 后\n- 直接将在 Matlab 或 Python 中训练好的权重文件导入 MLPNeuralNet，无需重写算法，确保了移动端与实验室模型的高度一致。\n- 利用 Accelerate 框架的矢量运算和硬件加速能力，在本地毫秒级完成预测，实现了真正的离线实时诊断。\n- 支持多层感知机的前向传播模式，完美适配分类与回归任务，轻松处理多特征输入的心脏病风险评估。\n- 模型迭代变得灵活高效，只需替换权重数据文件即可上线新策略，大幅缩短了产品迭代周期。\n\nMLPNeuralNet 通过桥接科研模型与移动终端，让复杂的 AI 预测能力得以在 iOS 设备上高效、离线且低成本地落地。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fnikolaypavlov_MLPNeuralNet_4215897f.png","nikolaypavlov","Mykola Pavlov","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fnikolaypavlov_393254e4.jpg","I'm a Data Scientist. My interests are signal processing, time series analysis, prediction analysis, machine learning, deep learning, RL-algorithms, AI.",null,"me@nikolaypavlov.com","https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fnikolaypavlov","https:\u002F\u002Fgithub.com\u002Fnikolaypavlov",[81,85],{"name":82,"color":83,"percentage":84},"Objective-C","#438eff",89.9,{"name":86,"color":87,"percentage":88},"Ruby","#701516",10.1,904,208,"2026-04-17T09:55:32","BSD-2-Clause","macOS, iOS","未说明（基于 Apple Accelerate Framework 进行 CPU 矢量化和硬件加速，无需独立 GPU 或 CUDA）","未说明",{"notes":97,"python":98,"dependencies":99},"该库专为 iOS 和 Mac OS X 设计，用于加载和运行已训练好的多层感知机模型（仅支持前向传播）。它依赖 Apple 的 Accelerate 框架进行底层计算优化。安装可通过 CocoaPods 或 Carthage，也可直接作为子项目导入。不支持 Linux 或 Windows，也不涉及 Python 环境或 NVIDIA GPU。","不适用（原生 Objective-C 库，非 Python 工具）",[100,101,102],"Apple Accelerate Framework","Xcode 5+","iOS 7+ SDK",[14],"2026-03-27T02:49:30.150509","2026-04-20T04:05:10.110864",[107,112,117,122,127,131],{"id":108,"question_zh":109,"answer_zh":110,"source_url":111},43328,"如何从 Python neurolab 中提取权重以适配此库？","大多数包（包括本库）中偏置神经元是隐式的，不需要在初始化层配置时指定，但必须提供正确数量的权重。每层（除输出层外）会有一个 +1 的偏置单元。例如，若配置为 input=4, hidden=4, output=1，实际权重计算需包含偏置。可以使用以下代码从 neurolab 提取权重：\n\n```python\nimport neurolab as nl\nimport numpy as np\n\ndef getweights(net):\n     vec = []\n     for layer in net.layers:\n         b = layer.np['b']\n         w = layer.np['w']\n         newvec = np.ravel(np.concatenate((b, np.ravel(w,order='F'))).reshape((layer.ci+1, layer.cn)), order = 'F')\n         [vec.append(nv) for nv in newvec]\n     return np.array(vec)\n```\n\n对于一个 256->16->10 的网络，这将返回 4282 个权重。","https:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002FMLPNeuralNet\u002Fissues\u002F3",{"id":113,"question_zh":114,"answer_zh":115,"source_url":116},43329,"更新后找不到 'MLPNone' 激活函数怎么办？","MLPNone 并未被移除，它存在于版本 1.0.10 中。如果您在更新 CocoaPods 后遇到 'Use of undeclared identifier MLPNone' 错误，请确认您是否成功更新到了最新版本。检查您的 Podfile 并运行 `pod update` 确保安装了包含该标识符的版本。","https:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002FMLPNeuralNet\u002Fissues\u002F16",{"id":118,"question_zh":119,"answer_zh":120,"source_url":121},43330,"示例中权重为 -30 的那个特定单元是什么？","那是偏置单元（bias unit）的权重。偏置单元在神经网络中用于调整激活函数的阈值，允许模型更好地拟合数据。如果您想了解偏置单元的具体作用，可以参考相关技术讨论（如 StackOverflow 上关于神经网络中偏置角色的回答）。","https:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002FMLPNeuralNet\u002Fissues\u002F9",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},43331,"是否有多个隐藏层的示例代码？","代码库中没有专门针对多个隐藏层的具体示例，但该库支持任意层配置。您可以尝试自定义 `layerConfig` 来创建具有多个隐藏层的网络结构，只需按照文档格式定义每一层的节点数即可。","https:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002FMLPNeuralNet\u002Fissues\u002F4",{"id":128,"question_zh":129,"answer_zh":130,"source_url":111},43332,"网络配置中的输入和输出向量大小是如何确定的？","输入向量大小取决于您的特征维度。例如，如果处理 16x16 的图像且值范围在 [0,1]，则输入向量大小为 256。输出向量大小取决于分类或回归任务的类别数。在创建网络时（如 `nl.net.newff(featureVector,[16,10])`），`featureVector` 定义了输入范围和维度，列表 `[16,10]` 分别代表第一个隐藏层和输出层的神经元数量。打印 `neuralNetowrk.ci` 和 `neuralNetowrk.co` 可以查看具体的输入和输出向量大小。",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},43333,"为什么改变输入值后输出结果始终相同？","如果改变输入值但输出结果不变（例如始终为 8.0），通常是因为网络未正确训练、权重初始化不当或输入数据预处理有误。维护者建议提供更具体的代码片段以便排查问题。请检查是否正确加载了权重，输入数据是否在预期的范围内（如 [0,1]），以及网络拓扑结构是否与权重向量匹配。","https:\u002F\u002Fgithub.com\u002Fnikolaypavlov\u002FMLPNeuralNet\u002Fissues\u002F8",[]]