GithubHelp home page GithubHelp logo

correlation_calculator_bundle's Introduction

CorrelationCalculatorBundle

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.

correlation_calculator_bundle's People

Contributors

addvilz avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.