• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MutableDouble类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中edu.stanford.nlp.util.MutableDouble的典型用法代码示例。如果您正苦于以下问题:Java MutableDouble类的具体用法?Java MutableDouble怎么用?Java MutableDouble使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MutableDouble类属于edu.stanford.nlp.util包,在下文中一共展示了MutableDouble类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: iterate

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/**
 * Iteration for lambda[index].
 * Returns true if this lambda hasn't converged. A lambda is deemed
 * converged if the change found for it is smaller then the parameter eps.
 */
boolean iterate(int index, double err, MutableDouble ret) {
  double deltaL = 0.0;
  deltaL = newton(deltaL, index, err);
  //System.out.println("delta is "+deltaL+" feature "+index+" expectation "+ftildeArr[index]);

  if (Math.abs(deltaL + lambda[index]) > 200) {
    if ((deltaL + lambda[index]) > 200) {
      deltaL = 200 - lambda[index];
    } else {
      deltaL = -lambda[index] - 200;
    }

    System.err.println("set delta to smth " + deltaL);
  }
  lambda[index] = lambda[index] + deltaL;
  if (Double.isNaN(deltaL)) {
    System.err.println(" NaN " + index + ' ' + deltaL);
  }
  ret.set(deltaL);
  return (Math.abs(deltaL) >= eps);
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:27,代码来源:LambdaSolve.java


示例2: iterate

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/**
 * Iteration for lambda[index].
 * Returns true if this lambda hasn't converged. A lambda is deemed
 * converged if the change found for it is smaller then the parameter eps.
 */
boolean iterate(int index, double err, MutableDouble ret) {
  double deltaL = 0.0;
  deltaL = newton(deltaL, index, err);
  //System.err.println("delta is "+deltaL+" feature "+index+" expectation "+ftildeArr[index]);

  if (Math.abs(deltaL + lambda[index]) > 200) {
    if ((deltaL + lambda[index]) > 200) {
      deltaL = 200 - lambda[index];
    } else {
      deltaL = -lambda[index] - 200;
    }

    System.err.println("set delta to smth " + deltaL);
  }
  lambda[index] = lambda[index] + deltaL;
  if (Double.isNaN(deltaL)) {
    System.err.println(" NaN " + index + ' ' + deltaL);
  }
  ret.set(deltaL);
  return (Math.abs(deltaL) >= eps);
}
 
开发者ID:jaimeguzman,项目名称:data_mining,代码行数:27,代码来源:LambdaSolve.java


示例3: remove

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/** {@inheritDoc} */
public double remove(E key) {
  MutableDouble d = mutableRemove(key); // this also updates totalCount
  if(d != null) {
    return d.doubleValue();
  }
  return Double.NaN;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:9,代码来源:ClassicCounter.java


示例4: values

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/** {@inheritDoc} */
public Collection<Double> values() {
  return new AbstractCollection<Double>() {
    @Override
    public Iterator<Double> iterator() {
      return new Iterator<Double>() {
        Iterator<MutableDouble> inner = map.values().iterator();

        public boolean hasNext() {
          return inner.hasNext();
        }

        public Double next() {
          // copy so as to give safety to mutable internal representation
          return Double.valueOf(inner.next().doubleValue());
        }

        public void remove() {
          throw new UnsupportedOperationException();
        }
      };
    }

    @Override
    public int size() {
      return map.size();
    }

    @Override
    public boolean contains(Object v) {
      return v instanceof Double && map.values().contains(new MutableDouble((Double) v));
    }

  };
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:36,代码来源:ClassicCounter.java


示例5: mutableRemove

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/** This is used internally to the class for getting back a
 *  MutableDouble in a remove operation.  Not for public use.
 *
 *  @param key The key to remove
 *  @return Its value as a MutableDouble
 */
private MutableDouble mutableRemove(E key) {
  MutableDouble md = map.remove(key);
  if (md != null) {
    totalCount -= md.doubleValue();
  }
  return md;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:14,代码来源:ClassicCounter.java


示例6: TwoDimensionalCounter

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
public TwoDimensionalCounter(MapFactory<K1, ClassicCounter<K2>> outerFactory,
    MapFactory<K2, MutableDouble> innerFactory) {
  innerMF = innerFactory;
  outerMF = outerFactory;
  map = outerFactory.newMap();
  total = 0.0;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:8,代码来源:TwoDimensionalCounter.java


示例7: remove

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public double remove(E key) {
  MutableDouble d = mutableRemove(key); // this also updates totalCount
  if(d != null) {
    return d.doubleValue();
  }
  return defaultValue;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:10,代码来源:ClassicCounter.java


示例8: values

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Collection<Double> values() {
  return new AbstractCollection<Double>() {
    @Override
    public Iterator<Double> iterator() {
      return new Iterator<Double>() {
        Iterator<MutableDouble> inner = map.values().iterator();

        @Override
        public boolean hasNext() {
          return inner.hasNext();
        }

        @Override
        public Double next() {
          // copy so as to give safety to mutable internal representation
          return Double.valueOf(inner.next().doubleValue());
        }

        @Override
        public void remove() {
          throw new UnsupportedOperationException();
        }
      };
    }

    @Override
    public int size() {
      return map.size();
    }

    @Override
    public boolean contains(Object v) {
      return v instanceof Double && map.values().contains(new MutableDouble((Double) v));
    }

  };
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:40,代码来源:ClassicCounter.java


示例9: improvedIterative

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/**
 * Iterate until convergence.  I usually use the other method that
 * does a fixed number of iterations.
 */
public void improvedIterative() {
  boolean flag;
  int iterations = 0;
  int numNConverged = p.fSize;
  do {
    if (VERBOSE) {
      System.err.println(iterations);
    }
    flag = false;
    iterations++;
    for (int i = 0; i < lambda.length; i++) {
      if (lambda_converged[i]) {
        continue;
      }
      MutableDouble deltaI = new MutableDouble();
      boolean fl = iterate(i, eps, deltaI);
      if (fl) {
        flag = true;
        updateConds(i, deltaI.doubleValue());
        // checkCorrectness();
      } else {
        //lambda_converged[i]=true;
        numNConverged--;
      }
    }
  } while ((flag) && (iterations < 1000));
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:32,代码来源:LambdaSolve.java


示例10: iterate

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/**
 * Iteration for lambda[index].
 *
 * @return true if this lambda hasn't converged.
 */
@SuppressWarnings({"UnusedDeclaration"})
boolean iterate(int index, double err, MutableDouble ret) {
  double deltaL = 0.0;
  deltaL = newton(deltaL, index, err);
  lambda[index] = lambda[index] + deltaL;
  if (!(deltaL == deltaL)) {
    System.err.println(" NaN " + index + ' ' + deltaL);
  }
  ret.set(deltaL);
  return (Math.abs(deltaL) >= eps);
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:17,代码来源:LambdaSolveTagger.java


示例11: improvedIterative

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/**
 * Iterate until convergence.  I usually use the other method that
 * does a fixed number of iterations.
 */
public void improvedIterative() {
  boolean flag;
  int iterations = 0;
  lambda_converged = new boolean[p.fSize];
  int numNConverged = p.fSize;
  do {
    if (VERBOSE) {
      System.err.println(iterations);
    }
    flag = false;
    iterations++;
    for (int i = 0; i < lambda.length; i++) {
      if (lambda_converged[i]) {
        continue;
      }
      MutableDouble deltaI = new MutableDouble();
      boolean fl = iterate(i, eps, deltaI);
      if (fl) {
        flag = true;
        updateConds(i, deltaI.doubleValue());
        // checkCorrectness();
      } else {
        //lambda_converged[i]=true;
        numNConverged--;
      }
    }
  } while ((flag) && (iterations < 1000));
}
 
开发者ID:jaimeguzman,项目名称:data_mining,代码行数:33,代码来源:LambdaSolve.java


示例12: getInnerMapFactory

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
public MapFactory<K2,MutableDouble> getInnerMapFactory() {
  return innerMF;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:4,代码来源:TwoDimensionalCounter.java


示例13: TwoDimensionalCounter

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
public TwoDimensionalCounter() {
  this(MapFactory.<K1,ClassicCounter<K2>>hashMapFactory(), MapFactory.<K2,MutableDouble>hashMapFactory());
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:4,代码来源:TwoDimensionalCounter.java


示例14: ClassicCounter

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
/**
 * Constructs a new (empty) Counter backed by a HashMap.
 */
public ClassicCounter() {
  this(MapFactory.<E,MutableDouble>hashMapFactory());
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:7,代码来源:ClassicCounter.java


示例15: ClassicCounterFactory

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
private ClassicCounterFactory(MapFactory<E,MutableDouble> mf) {
  this.mf = mf;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:4,代码来源:ClassicCounter.java


示例16: getInnerMapFactory

import edu.stanford.nlp.util.MutableDouble; //导入依赖的package包/类
public MapFactory<K2, MutableDouble> getInnerMapFactory() {
  return innerMF;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:4,代码来源:TwoDimensionalCounter.java



注:本文中的edu.stanford.nlp.util.MutableDouble类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Dataset类代码示例发布时间:2022-05-22
下一篇:
Java UTCProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap