|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.hankcs.hanlp.model.maxent.MaxEntModel
public class MaxEntModel
最大熵模型,采用双数组Trie树加速,值得拥有
| 字段摘要 | |
|---|---|
protected String[] |
outcomeNames
事件名 |
| 构造方法摘要 | |
|---|---|
MaxEntModel()
|
|
| 方法摘要 | |
|---|---|
static MaxEntModel |
create(ByteArray byteArray)
从字节流快速加载 |
static MaxEntModel |
create(String path)
从文件加载,同时缓存为二进制文件 |
static double[] |
eval(int[] context,
double[] prior,
EvalParameters model)
预测 |
double[] |
eval(String[] context)
预测分布 |
double[] |
eval(String[] context,
double[] outsums)
预测分布 |
static MaxEntModel |
load(String txtPath)
加载最大熵模型 如果存在缓存的话,优先读取缓存,否则读取txt,并且建立缓存 |
List<Pair<String,Double>> |
predict(Collection<String> context)
预测分布 |
List<Pair<String,Double>> |
predict(String[] context)
预测分布 |
Pair<String,Double> |
predictBest(String[] context)
预测概率最高的分类 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected String[] outcomeNames
| 构造方法详细信息 |
|---|
public MaxEntModel()
| 方法详细信息 |
|---|
public final double[] eval(String[] context)
context - 环境
public final List<Pair<String,Double>> predict(String[] context)
context -
public final Pair<String,Double> predictBest(String[] context)
context -
public final List<Pair<String,Double>> predict(Collection<String> context)
context -
public final double[] eval(String[] context,
double[] outsums)
context - 环境outsums - 先验分布
public static double[] eval(int[] context,
double[] prior,
EvalParameters model)
context - 环境prior - 先验概率model - 特征函数
public static MaxEntModel create(String path)
path -
public static MaxEntModel create(ByteArray byteArray)
byteArray -
public static MaxEntModel load(String txtPath)
txtPath - txt的路径,即使不存在.txt,只存在.bin,也应传入txt的路径,方法内部会自动加.bin后缀
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||