资源简介
用信息论中的熵作为衡量两个变量之间相关性的指标,计算两个变量之间相关性需要用到互信息的计算,互信息工具箱中提供了相关的mi函数
代码片段和文件信息
/*******************************************************************************
** ArrayOperations.cpp
** Part of the mutual information toolbox
**
** Contains functions to floor arrays and to merge arrays into a joint
** state.
**
** Author: Adam Pocock
** Created 17/2/2010
**
** Copyright 2010 Adam Pocock The University Of Manchester
** www.cs.manchester.ac.uk
**
** This file is part of MIToolbox.
**
** MIToolbox is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation either version 3 of the License or
** (at your option) any later version.
**
** MIToolbox is distributed in the hope that it will be useful
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with MIToolbox. If not see .
**
*******************************************************************************/
#include “MIToolbox.h“
#include “ArrayOperations.h“
void printDoubleVector(double *vector int vectorLength)
{
int i;
for (i = 0; i < vectorLength; i++)
{
if (vector[i] > 0)
printf(“Val at i=%d is %f\n“ivector[i]);
}/*for number of items in vector*/
}/*printDoubleVector(double*int)*/
void printIntVector(int *vector int vectorLength)
{
int i;
for (i = 0; i < vectorLength; i++)
{
printf(“Val at i=%d is %d\n“ivector[i]);
}/*for number of items in vector*/
}/*printIntVector(int*int)*/
int numberOfUniqueValues(double *featureVector int vectorLength)
{
int uniqueValues = 0;
double *valuesArray = (double *) CALLOC_FUNC(vectorLengthsizeof(double));
int found = 0;
int j = 0;
int i;
for (i = 0; i < vectorLength; i++)
{
found = 0;
j = 0;
while ((j < uniqueValues) && (found == 0))
{
if (valuesArray[j] == featureVector[i])
{
found = 1;
featureVector[i] = (double) (j+1);
}
j++;
}
if (!found)
{
valuesArray[uniqueValues] = featureVector[i];
uniqueValues++;
featureVector[i] = (double) uniqueValues;
}
}/*for vectorlength*/
FREE_FUNC(valuesArray);
valuesArray = NULL;
return uniqueValues;
}/*numberOfUniqueValues(double*int)*/
/*******************************************************************************
** normaliseArray takes an input vector and writes an output vector
** which is a normalised version of the input and returns the number of states
** A normalised array has min value = 0 max value = number of states
** and all values are integers
**
** length(inputVector) == length(outputVector) == vectorLength otherwise there
** is a memory leak
*******************************************************************************/
int normaliseArray(doubl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-11-28 23:12 MIToolbox\
文件 8656 2013-04-09 10:31 MIToolbox\ArrayOperations.c
文件 3873 2013-04-09 10:31 MIToolbox\ArrayOperations.h
文件 35147 2013-04-09 10:31 MIToolbox\COPYING
文件 7637 2013-04-09 10:31 MIToolbox\COPYING.LESSER
文件 11013 2013-04-09 10:31 MIToolbox\CalculateProbability.c
文件 4185 2013-04-09 10:31 MIToolbox\CalculateProbability.h
文件 345 2013-04-09 10:31 MIToolbox\CompileMIToolbox.m
文件 3951 2013-04-09 10:31 MIToolbox\Entropy.c
文件 2733 2013-04-09 10:31 MIToolbox\Entropy.h
文件 1762 2013-04-09 10:31 MIToolbox\MIToolbox.h
文件 2533 2013-04-09 10:31 MIToolbox\MIToolbox.m
文件 15363 2013-04-09 10:31 MIToolbox\MIToolboxMex.c
文件 16384 2013-04-11 14:56 MIToolbox\MIToolboxMex.mexw64
文件 3551 2013-04-09 10:31 MIToolbox\Makefile
文件 3859 2013-04-09 10:31 MIToolbox\MutualInformation.c
文件 2564 2013-04-09 10:31 MIToolbox\MutualInformation.h
文件 2904 2013-04-09 10:31 MIToolbox\README
文件 5902 2013-04-09 10:31 MIToolbox\RenyiEntropy.c
文件 2654 2013-04-09 10:31 MIToolbox\RenyiEntropy.h
文件 1473 2013-04-09 10:31 MIToolbox\RenyiMIToolbox.m
文件 5915 2013-04-09 10:31 MIToolbox\RenyiMIToolboxMex.c
文件 11264 2013-04-11 14:56 MIToolbox\RenyiMIToolboxMex.mexw64
文件 3582 2013-04-09 10:31 MIToolbox\RenyiMutualInformation.c
文件 2343 2013-04-09 10:31 MIToolbox\RenyiMutualInformation.h
文件 4843 2013-04-09 10:31 MIToolbox\WeightedEntropy.c
文件 2926 2013-04-09 10:31 MIToolbox\WeightedEntropy.h
文件 2876 2013-04-09 10:31 MIToolbox\WeightedMIToolbox.m
文件 13439 2013-04-09 10:31 MIToolbox\WeightedMIToolboxMex.c
文件 14848 2013-04-11 14:56 MIToolbox\WeightedMIToolboxMex.mexw64
文件 4171 2013-04-09 10:31 MIToolbox\WeightedMutualInformation.c
............此处省略19个文件信息
- 上一篇:提取文件.txt
- 下一篇:MSCOMM控件加脚本注册
评论
共有 条评论