承接 addvilz/correlation_calculator_bundle 相关项目开发

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

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

addvilz/correlation_calculator_bundle

最新稳定版本:v1.0

Composer 安装命令:

composer require addvilz/correlation_calculator_bundle

包简介

README 文档

README

This bundle provides simple implementation of Pearson product-moment correlation coefficient calculator.

It can be used to calculate correlation coefficient between two samples of data (X and Y).

The resulting correlation coefficient ranges from −1 to 1. A value of 1 implies that a linear equation describes the relationship between X and Y perfectly, with all data points lying on a line for which Y increases as X increases. A value of −1 implies that all data points lie on a line for which Y decreases as X increases. A value of 0 implies that there is no linear correlation between the variables.

Installation

composer require addvilz/correlation_calculator_bundle

Sample usage

Symfony2 service

Bundle exposes service addvilz_correlation_calculator.correlation_calculator, an instance of CorrelationCalculator.

You can use it like this:

    services:
        myvendor.bundle.some_class:
            class: MyClass
            arguments:
                @addvilz_correlation_calculator.correlation_calculator
    class MyClass
    {
        private $correlationCalculator;

        function __construct(CorrelactionCalculator $correlationCalculator)
        {
            $this->correlationCalculator = $correlationCalculator;
        }

        function doStuff(array $x, array $y)
        {
            $this->correlationCalculator->calculateCoefficient(new SampleCollection($x, $y));
        }
    }

Standalone

<?php
$sampleCollection = new SampleCollection([1, 2, 3], [4, 5, 6]);
$calculator = new CorrelationCalculator();
$result = $calculator->calculateCoefficient($sampleCollection); // 1.0

License

Licensed under terms and conditions of Apache 2.0 license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2015-07-24