<commit_before>PACKAGE

package mahalanobis
    import "github.com/ant0ine/go.mahalanobis"

    Naive implementation of the Mahalanobis distance using go.matrix
    (https://en.wikipedia.org/wiki/Mahalanobis_distance)

    This is me learning Go, it's probably broken, don't use it.

    Example:

	package main
	import (
	    "fmt"
	    "github.com/skelterjohn/go.matrix"
	    "github.com/ant0ine/go.mahalanobis"
	)
	func main() {
	    points, err := matrix.ParseMatlab("[1 4 3 4;4 2 3 4]")
	    if err != nil {
	    panic(err)
	    }
	    fmt.Println("4 points:\n", points)
	    target, err := matrix.ParseMatlab("[3;4]")
	    if err != nil {
	        panic(err)
	    }
	    fmt.Println("the target point:\n", target)
	    distance, err := mahalanobis.Distance(points, target)
	    if err != nil {
	        panic(err)
	    }
	    fmt.Println("Mahalanobis distance=", distance)
	}

FUNCTIONS

func CovarianceMatrix(points *matrix.DenseMatrix) *matrix.DenseMatrix
    Return the covariance matrix for this set of points (sample covariance
    is used)

func Distance(points, target *matrix.DenseMatrix) (float64, error)
    Return the Mahalanobis distance

func DistanceSquare(points, target *matrix.DenseMatrix) (float64, error)
    Return the square of the Mahalanobis distance

func MeanVector(points *matrix.DenseMatrix) *matrix.DenseMatrix
    Given a set a points, return the mean vector.

<commit_msg>update README from go doc<commit_after>PACKAGE

package mahalanobis
    import "github.com/ant0ine/go.mahalanobis"

    Naive implementation of the Mahalanobis distance using go.matrix
    (https://en.wikipedia.org/wiki/Mahalanobis_distance)

    This is me learning Go, it's probably broken, don't use it.

    Example:

	package main
	import (
	    "fmt"
	    "github.com/skelterjohn/go.matrix"
	    "github.com/ant0ine/go.mahalanobis"
	)
	func main() {
	    points, err := matrix.ParseMatlab("[1 4 3 4;4 2 3 4]")
	    if err != nil {
	    panic(err)
	    }
	    fmt.Println("4 points:\n", points)
	    target, err := matrix.ParseMatlab("[3;4]")
	    if err != nil {
	        panic(err)
	    }
	    fmt.Println("the target point:\n", target)
	    distance, err := mahalanobis.Distance(points, target)
	    if err != nil {
	        panic(err)
	    }
	    fmt.Println("Mahalanobis distance=", distance)
	}

FUNCTIONS

func CovarianceMatrix(points *matrix.DenseMatrix) *matrix.DenseMatrix
    Return the covariance matrix for this set of points (sample covariance
    is used) points.Rows() = dimensions. points.Cols() = number of points.

func Distance(points, target *matrix.DenseMatrix) (float64, error)
    Return the Mahalanobis distance points.Rows() = dimensions.
    points.Cols() = number of points. target.Cols = 1

func DistanceSquare(points, target *matrix.DenseMatrix) (float64, error)
    Return the square of the Mahalanobis distance points.Rows() =
    dimensions. points.Cols() = number of points. target.Cols = 1

func MeanVector(points *matrix.DenseMatrix) *matrix.DenseMatrix
    Given a set a points, return the mean vector. points.Rows() =
    dimensions. points.Cols() = number of points.


{'fraction_non_alphanumeric': 0.10833333333333334, 'fraction_numerical': 0.011538461538461539, 'mean_word_length': 3.2462585034013607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1810858', 'n_tokens_mistral': 1094, 'n_tokens_neox': 994, 'n_words': 284}