New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

entropy-ts

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

entropy-ts

信息熵

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

entropy-ts

信息熵,使用 TypeScript 实现。

npm download NPM version Build Status Dependencies Status Coverage Status code style: prettier

信息熵

在机器学习中,熵刻画了任意样例集的纯度。给定包含关于某个目标概念的正反样例的样例集 S,那么 S 相对这个布尔型分类的熵为:

Entropy(S) = -p+log2(p+) - p-log2(p-)

其中,p+是在 S 中正例的比例,p-是在 S 中反例的比例。在有关熵的所有计算中我们定义 0log0 为 0。

安装

npm install entropy-ts

使用

import { entropy } from 'entropy-ts'

const samples = [
  '+', '+', '-', '+', '-', '-'
]

const res = entropy(samples)

assert.deepStrictEqual(res, 1)

开发

  • 修改代码后跑

    npm test
    

    确保测试通过。

  • git commit

  • npm version patch/minor/major

  • npm publish

FAQs

Package last updated on 23 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts