承接 dragonzap/neuralnetwork 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dragonzap/neuralnetwork

最新稳定版本:v1.1.0

Composer 安装命令:

composer require dragonzap/neuralnetwork

包简介

Used for building neural networks in PHP

README 文档

README

This is a PHP package for building neural networks in PHP, if theirs enough interest I will adapt it into a PHP C module providing very quick training on the CPU and GPU.

Example Usage

 $total_hidden_neurons = 4;
    $total_hidden_layers = 2;
    $learning_rate = 0.1;
    $epochs = 500000;
    $total_input_neurons = 2;
    $total_output_neurons = 1;

    // You can use either "relu" or "sigmoid" for the activation function
    $network = new NeuralNetwork($total_input_neurons, $total_output_neurons, $learning_rate, $epochs, $total_hidden_neurons, $total_hidden_layers, 'relu');

    // Train the network on one page at a time, useful for large datasets
    // where you can simply load from the database.
    $network->trainNetworkBatch(4, function ($page, $total_per_page, &$input, &$output) {
        switch ($page) {
            case 0:
                $input = [
                    [0, 0],
                    [1, 0],
                    [0, 1],
                ];
                $output = [
                    [0], [1], [1]
                ];
                break;
            case 1:
                $input = [
                    [1, 1]
                ];
                $output = [
                    [0]
                ];
                break;
          
            default:
                echo 'out of bounds';
                exit;
                break;
        }
    }, 3);


    $network->forwardPass([1, 0], $output);
    print_r($output);

统计信息

  • 总下载量: 52
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2024-05-30