92 lines
1.6 KiB
JavaScript
92 lines
1.6 KiB
JavaScript
|
var data1 = [
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
['a','A'],
|
||
|
]
|
||
|
|
||
|
var data2 = [
|
||
|
['a','A'],
|
||
|
['b','A'],
|
||
|
['a','A'],
|
||
|
['b','A'],
|
||
|
['a','A'],
|
||
|
['b','A'],
|
||
|
['a','A'],
|
||
|
['b','A'],
|
||
|
['a','A'],
|
||
|
['b','A'],
|
||
|
]
|
||
|
|
||
|
var data3 = [
|
||
|
['a','A'],
|
||
|
['b','B'],
|
||
|
['c','C'],
|
||
|
['a','A'],
|
||
|
['b','B'],
|
||
|
['c','C'],
|
||
|
['a','A'],
|
||
|
['b','B'],
|
||
|
['c','C'],
|
||
|
['a','A'],
|
||
|
]
|
||
|
|
||
|
var data43 = [
|
||
|
['a','A'],
|
||
|
['b','B'],
|
||
|
['c','C'],
|
||
|
['a','C'],
|
||
|
['b','A'],
|
||
|
['c','B'],
|
||
|
['a','B'],
|
||
|
['b','C'],
|
||
|
['c','A'],
|
||
|
['a','A'],
|
||
|
]
|
||
|
|
||
|
var data42 = [
|
||
|
['a','A'],
|
||
|
['b','B'],
|
||
|
['c','B'],
|
||
|
['a','B'],
|
||
|
['b','A'],
|
||
|
['c','B'],
|
||
|
['a','B'],
|
||
|
['b','A'],
|
||
|
['c','A'],
|
||
|
['a','A'],
|
||
|
]
|
||
|
|
||
|
var data44 = [
|
||
|
['a','A'],
|
||
|
['b','D'],
|
||
|
['c','B'],
|
||
|
['a','B'],
|
||
|
['b','A'],
|
||
|
['c','C'],
|
||
|
['a','B'],
|
||
|
['b','A'],
|
||
|
['c','A'],
|
||
|
['a','C'],
|
||
|
]
|
||
|
|
||
|
print('entropy of data1',ml.stats.entropy(ml.stats.utils.column(data1,0)))
|
||
|
print('entropy of data2',ml.stats.entropy(ml.stats.utils.column(data2,0)))
|
||
|
print('entropy of data3',ml.stats.entropy(ml.stats.utils.column(data3,0)))
|
||
|
print('entropy of data42',ml.stats.entropy(ml.stats.utils.column(data42,0)))
|
||
|
print('entropy of data43',ml.stats.entropy(ml.stats.utils.column(data43,0)))
|
||
|
|
||
|
print('dep. entropy of data1',ml.stats.entropyT(data1,0,1,['A','B','C']))
|
||
|
print('dep. entropy of data2',ml.stats.entropyT(data2,0,1,['A','B','C']))
|
||
|
print('dep. entropy of data3',ml.stats.entropyT(data3,0,1,['A','B','C']))
|
||
|
print('dep. entropy of data42',ml.stats.entropyT(data42,0,1,['A','B']))
|
||
|
print('dep. entropy of data43',ml.stats.entropyT(data43,0,1,['A','B','C']))
|
||
|
print('dep. entropy of data44',ml.stats.entropyT(data44,0,1,['A','B','C','D']))
|
||
|
|