Home

Awesome

gomi is a software package for the evaluation of morphological intelligence measures on data. gomi includes all currently available morphological intelligence measures. This includes measures with continuous estimators as well as measures that use a discrete estimator.

The following sections will only provide minimal information about the measures. The goal of this post to provide information about the application of the measures, not an introduction of the measures themselves. For this purpose, please visit the other posts on these pages:

gomi is written in Go. For the installation of Go, please read the installation documentation provided here. Pre-compiled binaries of gomi for Windows, Linux, and macOS are available in the release files here.

Once Go is installed, gomi can easily be installed using the following commands:

go get github.com/kzahedi/gomi

The following two packages are required and might have to be installed manually:

go get github.com/kzahedi/goent
go get github.com/kzahedi/utils

A zip (and tarball) of stable releases can be downloaded [here].

Using the gomi binary

To calculate MI_W with the binary, use the following command line parameters:

gomi -mi MI_W -file musfib.csv -wi 1,2,3 -ai 9 -v -bins 300 -o MI_W.csv

The file musfib was used in [1] and can be downloaded here.

Explanation of the command line options used in the example above:

OptionExplanation
-mi MI_WChooses MI_W as the measure
-file musfib.csvData is provided in the file musfib.csv
-wi 1,2,3Columns 1,2,3 of the data provided in musfib.csv define the world state (counting starts with 0)
-ai 9Column 9 of the data provided in musfib.csv defines the action state (counting starts with 0)
-vgomi will print useful information while it is running and it will print the result
-bins 300Global definition of the binning. This value will be used for each of the four columns
-o MI_W.csvThe result and the specified parameters will be written to MI_W.csv

Using gomi as a library

Using gomi as a library The measures implemented in gomi can also be used as a library. The following code snippet gives an example:

package main

import (
	"fmt"

	"github.com/kzahedi/goent/dh"
	goent "github.com/kzahedi/goent/discrete"
	mc "github.com/kzahedi/gomi/discrete"
)

func main() {
	// W and A are just examples for data. These would usually be read from some data file
	// For this example to work, we provide some dummy data
	w := [][]float64{{0.0, 1.0},
		{0.1, 1.1},
		{0.2, 1.2},
		{0.3, 1.3},
		{0.4, 1.4}}

	a := [][]float64{{0.0, 1.0, 2.0},
		{0.1, 1.1, 2.1},
		{0.2, 1.2, 2.2},
		{0.3, 1.3, 2.3},
		{0.4, 1.4, 2.4}}

	// discretising data. Discrestise(data, bins for each column, min values for each column, max values for each column)
	wDiscretised := dh.Discretise(w, []int{10, 10}, []float64{0.0, 0.0}, []float64{1.0, 2.0})
	aDiscretised := dh.Discretise(a, []int{10, 10, 10}, []float64{0.0, 0.0, 0.0}, []float64{1.0, 2.0, 3.0})
 
	// univariate variables
	wUnivariate := dh.MakeUnivariateRelabelled(wDiscretised, []int{10, 10})
	aUnivariate := dh.MakeUnivariateRelabelled(aDiscretised, []int{10, 10, 10})
 
	// creating w', w, a data
	w2w1a1 := make([][]int, len(w)-1, len(w)-1)
 
	for i := 0; i < len(w)-1; i++ {
		w2w1a1[i] = make([]int, 3, 3)
		w2w1a1[i][0] = wUnivariate[i+1]
		w2w1a1[i][1] = wUnivariate[i]
		w2w1a1[i][2] = aUnivariate[i]
	}
 
	// calculating p(w',w,a)
	pw2w1a1 := goent.Emperical3D(w2w1a1)
 
	// calculating MI_W
	result := mc.MorphologicalComputationW(pw2w1a1)
 
	fmt.Println(result)
}

A complete reference can be found at here.

References: