本文整理汇总了Java中org.apache.commons.math3.stat.descriptive.rank.Min.increment方法的典型用法代码示例。如果您正苦于以下问题:Java Min.increment方法的具体用法?Java Min.increment怎么用?Java Min.increment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.stat.descriptive.rank.Min
的用法示例。
在下文中一共展示了Min.increment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDistribution
import org.apache.commons.math3.stat.descriptive.rank.Min; //导入方法依赖的package包/类
public DistributionApproximation getDistribution(Connection conn, DataTableName tableName, VariableName thetaName,
VariableName weightName, boolean hasWeight)throws SQLException {
points = new ArrayList<Double>();
Min min = new Min();
Max max = new Max();
Table sqlTable = new Table(tableName.getNameForDatabase());
SelectQuery query = new SelectQuery();
query.addColumn(sqlTable, thetaName.nameForDatabase());
if(hasWeight){
query.addColumn(sqlTable, weightName.nameForDatabase());
weights = new ArrayList<Double>();
}
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(query.toString());
double value = 0.0;
double w = 1.0;
while(rs.next()){
value = rs.getDouble(thetaName.nameForDatabase());
if(!rs.wasNull()){
if(hasWeight){
w = rs.getDouble(weightName.nameForDatabase());
if(rs.wasNull()){
w=0.0;
}
points.add(value);
weights.add(w);
min.increment(value);
max.increment(value);
}else{
points.add(value);
min.increment(value);
max.increment(value);
}
}
}
rs.close();
stmt.close();
ContinuousDistributionApproximation dist = new ContinuousDistributionApproximation(points.size(), min.getResult(), max.getResult());
if(hasWeight){
for(int i=0;i<points.size();i++){
dist.setPointAt(i, points.get(i));
dist.setDensityAt(i, weights.get(i));
}
}else{
for(int i=0;i<points.size();i++){
dist.setPointAt(i, points.get(i));
}
}
return dist;
}
示例2: initializeGridPoints
import org.apache.commons.math3.stat.descriptive.rank.Min; //导入方法依赖的package包/类
private void initializeGridPoints()throws SQLException{
Statement stmt = null;
ResultSet rs = null;
//connect to db
try{
Table sqlTable = new Table(tableName.getNameForDatabase());
SelectQuery select = new SelectQuery();
select.addColumn(sqlTable, regressorVariable.getName().nameForDatabase());
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(select.toString());
Min min = new Min();
Max max = new Max();
Mean mean = new Mean();
StandardDeviation sd = new StandardDeviation();
double value = 0.0;
while(rs.next()){
value = rs.getDouble(regressorVariable.getName().nameForDatabase());
if(!rs.wasNull()){
min.increment(value);
max.increment(value);
mean.increment(value);
sd.increment(value);
}
updateProgress();
}
rs.close();
stmt.close();
//evaluation points
double sdv = sd.getResult();
double mn = mean.getResult();
double lower = mn-2.5*sdv;
double upper = mn+2.5*sdv;
bwAdjustment *= sdv;
bandwidth = new NonparametricIccBandwidth(sampleSize, bwAdjustment);
gridPoints = command.getFreeOption("gridpoints").getInteger();
// uniformDistributionApproximation = new UniformDistributionApproximation(
// min.getResult(), max.getResult(), gridPoints);
uniformDistributionApproximation = new UniformDistributionApproximation(
lower, upper, gridPoints);
}catch(SQLException ex){
throw ex;
}finally{
if(rs!=null) rs.close();
if(stmt!=null) stmt.close();
}
}