当前位置: 首页>>代码示例>>Java>>正文


Java TIntArrayList.setQuick方法代码示例

本文整理汇总了Java中gnu.trove.TIntArrayList.setQuick方法的典型用法代码示例。如果您正苦于以下问题:Java TIntArrayList.setQuick方法的具体用法?Java TIntArrayList.setQuick怎么用?Java TIntArrayList.setQuick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.TIntArrayList的用法示例。


在下文中一共展示了TIntArrayList.setQuick方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setDocumentFeatureFrequency

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void setDocumentFeatureFrequency(int document, int feature, int frequency) {
    if (document >= 0) {
        int size = _contentDB._documentsFeatures.size();
        if (document >= size) {
            for (int i = size; i <= document; ++i) {
                _contentDB._documentsFeatures.add(new TIntArrayList());
                _contentDB._documentsFrequencies.add(new TIntArrayList());
            }
        }
        if (feature >= 0) {
            TIntArrayList feats = _contentDB._documentsFeatures.get(document);
            TIntArrayList freqs = _contentDB._documentsFrequencies.get(document);
            int pos = feats.binarySearch(feature);
            if (pos < 0 && frequency > 0) {
                pos = -pos - 1;
                feats.insert(pos, feature);
                freqs.insert(pos, frequency);
            } else {
                if (frequency > 0) {
                    freqs.setQuick(pos, frequency);
                } else {
                    feats.remove(pos);
                    freqs.remove(pos);
                }
            }
        }
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:29,代码来源:TroveContentDBBuilder.java

示例2: setDocumentFeatureFrequency

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void setDocumentFeatureFrequency(int document, int feature,
                                        int frequency) {
    if (feature >= 0) {
        int size = _contentDB._featuresDocuments.size();
        if (feature >= size) {
            for (int i = size; i <= feature; ++i) {
                _contentDB._featuresDocuments.add(new TIntArrayList());
                _contentDB._featuresFrequencies.add(new TIntArrayList());
            }
        }
        if (document >= 0) {
            TIntArrayList docs = _contentDB._featuresDocuments.get(feature);
            TIntArrayList freqs = _contentDB._featuresFrequencies
                    .get(feature);
            int pos = docs.binarySearch(document);
            if (pos < 0 && frequency > 0) {
                pos = -pos - 1;
                docs.insert(pos, document);
                freqs.insert(pos, frequency);
            } else {
                if (frequency > 0) {
                    freqs.setQuick(pos, frequency);
                } else {
                    docs.remove(pos);
                    freqs.remove(pos);
                }
            }
        }
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:31,代码来源:TroveContentILDBBuilder.java

示例3: removeFeatures

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
    for (int i = 0; i < _documentsFeatures.size(); ++i) {
        TIntArrayList feats = _documentsFeatures.get(i);
        TIntArrayList freqs = _documentsFrequencies.get(i);
        int j = 0;
        int shift = 0;
        int feat;
        int rem;
        if (j < feats.size() && removedFeatures.hasNext()) {
            feat = feats.getQuick(j);
            rem = removedFeatures.next();

            while (true) {
                if (feat == rem) {
                    feats.remove(j);
                    freqs.remove(j);
                    if (j < feats.size() && removedFeatures.hasNext()) {
                        feat = feats.getQuick(j);
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else if (feat > rem) {
                    if (removedFeatures.hasNext()) {
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else {
                    feats.setQuick(j, feat - shift);
                    ++j;
                    if (j < feats.size())
                        feat = feats.getQuick(j);
                    else
                        break;
                }
            }
            ++shift;
        }

        while (j < feats.size()) {
            feats.setQuick(j, feats.getQuick(j) - shift);
            ++j;
        }
        removedFeatures.begin();
    }
    _documentLenghts.clear();
    _featureDocumentsCount.clear();
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:50,代码来源:TroveContentDB.java

示例4: removeDocuments

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeDocuments(IIntIterator removedDocuments) {
    for (int i = 0; i < _categoriesDocuments.size(); ++i) {
        TIntArrayList docs = _categoriesDocuments.get(i);
        Vector<Boolean> docsPrimary = _categoriesDocumentsPrimary.get(i);
        int j = 0;
        int shift = 0;
        int doc;
        int rem;
        if (j < docs.size() && removedDocuments.hasNext()) {
            doc = docs.getQuick(j);
            rem = removedDocuments.next();

            while (true) {
                if (doc == rem) {
                    docs.remove(j);
                    docsPrimary.remove(j);
                    if (j < docs.size() && removedDocuments.hasNext()) {
                        doc = docs.getQuick(j);
                        rem = removedDocuments.next();
                        ++shift;
                    } else
                        break;
                } else if (doc > rem) {
                    if (removedDocuments.hasNext()) {
                        rem = removedDocuments.next();
                        ++shift;
                    } else
                        break;
                } else {
                    docs.setQuick(j, doc - shift);
                    ++j;
                    if (j < docs.size())
                        doc = docs.getQuick(j);
                    else
                        break;
                }
            }
            ++shift;
        }
        while (j < docs.size()) {
            docs.setQuick(j, docs.getQuick(j) - shift);
            ++j;
        }
        removedDocuments.begin();
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:47,代码来源:TroveClassificationILDB.java

示例5: removeFeatures

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
    for (int i = 0; i < _documentsWeights.size(); ++i) {
        TIntDoubleHashMap weigs = _documentsWeights.get(i);
        TIntArrayList feats = new TIntArrayList(weigs.size());
        TDoubleArrayList weigths = new TDoubleArrayList(weigs.size());
        TIntDoubleIterator wit = weigs.iterator();
        while (wit.hasNext()) {
            wit.advance();
            feats.add(wit.key());
            weigths.add(wit.value());
        }
        int j = 0;
        int shift = 0;
        int feat;
        int rem;
        if (j < feats.size() && removedFeatures.hasNext()) {
            feat = feats.getQuick(j);
            rem = removedFeatures.next();

            while (true) {
                if (feat == rem) {
                    feats.remove(j);
                    weigths.remove(j);
                    if (j < feats.size() && removedFeatures.hasNext()) {
                        feat = feats.getQuick(j);
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else if (feat > rem) {
                    if (removedFeatures.hasNext()) {
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else {
                    feats.setQuick(j, feat - shift);
                    ++j;
                    if (j < feats.size())
                        feat = feats.getQuick(j);
                    else
                        break;
                }
            }
            ++shift;
        }
        while (j < feats.size()) {
            feats.setQuick(j, feats.getQuick(j) - shift);
            ++j;
        }

        weigs.clear();
        for (j = 0; j < feats.size(); ++j)
            weigs.put(feats.getQuick(j), weigths.getQuick(j));

        removedFeatures.begin();
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:59,代码来源:TroveWeightingDB.java

示例6: removeFeatures

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
    for (int i = 0; i < _categoriesFeatures.size(); ++i) {
        TIntArrayList feats = _categoriesFeatures.get(i);
        int j = 0;
        int shift = 0;
        int feat;
        int rem;
        if (j < feats.size() && removedFeatures.hasNext()) {
            feat = feats.getQuick(j);
            rem = removedFeatures.next();

            while (true) {
                if (feat == rem) {
                    feats.remove(j);
                    if (j < feats.size() && removedFeatures.hasNext()) {
                        feat = feats.getQuick(j);
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else if (feat > rem) {
                    if (removedFeatures.hasNext()) {
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else {
                    feats.setQuick(j, feat - shift);
                    ++j;
                    if (j < feats.size())
                        feat = feats.getQuick(j);
                    else
                        break;
                }
            }
        }
        while (j < feats.size()) {
            feats.setQuick(j, feats.getQuick(j) - shift);
            ++j;
        }
        removedFeatures.begin();
    }
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:44,代码来源:TroveDomainDB.java

示例7: removeDocuments

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeDocuments(IIntIterator removedDocuments) {
    for (int i = 0; i < _featuresDocuments.size(); ++i) {
        TIntArrayList docs = _featuresDocuments.get(i);
        TIntArrayList freqs = _featuresFrequencies.get(i);
        int j = 0;
        int shift = 0;
        int doc;
        int rem;
        if (j < docs.size() && removedDocuments.hasNext()) {
            doc = docs.getQuick(j);
            rem = removedDocuments.next();

            while (true) {
                if (doc == rem) {
                    docs.remove(j);
                    freqs.remove(j);
                    if (j < docs.size() && removedDocuments.hasNext()) {
                        doc = docs.getQuick(j);
                        rem = removedDocuments.next();
                        ++shift;
                    } else
                        break;
                } else if (doc > rem) {
                    if (removedDocuments.hasNext()) {
                        rem = removedDocuments.next();
                        ++shift;
                    } else
                        break;
                } else {
                    docs.setQuick(j, doc - shift);
                    ++j;
                    if (j < docs.size())
                        doc = docs.getQuick(j);
                    else
                        break;
                }
            }
            ++shift;
        }
        while (j < docs.size()) {
            docs.setQuick(j, docs.getQuick(j) - shift);
            ++j;
        }
        removedDocuments.begin();
    }
    removedDocuments.begin();
    while (removedDocuments.hasNext()) {
        int document = removedDocuments.next();
        _documentFeaturesCount.remove(document);
        _documentLenghts.remove(document);
    }

}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:54,代码来源:TroveContentILDB.java

示例8: removeFeatures

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
public void removeFeatures(IIntIterator removedFeatures) {
    int shift = 0;
    while (removedFeatures.hasNext()) {
        int feature = removedFeatures.next() - shift;
        _featuresDocuments.remove(feature);
        _featuresFrequencies.remove(feature);
        ++shift;
    }
    removedFeatures.begin();
    for (int i = 0; i < _documentsFeatures.size(); ++i) {
        TIntArrayList feats = _documentsFeatures.get(i);
        TIntArrayList freqs = _documentsFrequencies.get(i);
        int j = 0;
        shift = 0;
        int feat;
        int rem;
        if (j < feats.size() && removedFeatures.hasNext()) {
            feat = feats.getQuick(j);
            rem = removedFeatures.next();

            while (true) {
                if (feat == rem) {
                    feats.remove(j);
                    freqs.remove(j);
                    if (j < feats.size() && removedFeatures.hasNext()) {
                        feat = feats.getQuick(j);
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else if (feat > rem) {
                    if (removedFeatures.hasNext()) {
                        rem = removedFeatures.next();
                        ++shift;
                    } else
                        break;
                } else {
                    feats.setQuick(j, feat - shift);
                    ++j;
                    if (j < feats.size())
                        feat = feats.getQuick(j);
                    else
                        break;
                }
            }
            ++shift;
        }
        while (j < feats.size()) {
            feats.setQuick(j, feats.getQuick(j) - shift);
            ++j;
        }
        removedFeatures.begin();
    }
    _documentLenghts.clear();
}
 
开发者ID:jatecs,项目名称:jatecs,代码行数:56,代码来源:TroveContentFullDB.java

示例9: nextMicroTable

import gnu.trove.TIntArrayList; //导入方法依赖的package包/类
protected TIntDoubleHashMap nextMicroTable(ContingencyTableSet oldEvaluation, ContingencyTableSet newEvaluation) {
        if (oldEvaluation != null && newEvaluation != null && !oldEvaluation.equals(newEvaluation)) {
            ContingencyTable newContingency = newEvaluation.getGlobalContingencyTable();
            ContingencyTable oldContingency = oldEvaluation.getGlobalContingencyTable();
            TIntArrayList increment = new TIntArrayList(4);
            increment.setQuick(0, newContingency.tp() - oldContingency.tp());
            increment.setQuick(1, newContingency.tn() - oldContingency.tn());
            increment.setQuick(2, newContingency.fp() - oldContingency.fp());
            increment.setQuick(3, newContingency.fn() - oldContingency.fn());
            if (increment.getQuick(0) != 0 || increment.getQuick(1) != 0 || increment.getQuick(2) != 0 || increment.getQuick(3) != 0) {
                for (int j = 0; j < 4; j++) {
                    globalContingencies[j] += increment.getQuick(j);
//                    if (globalContingencies[j] < 0.0) {
//                        globalContingencies[j] = 0.0;
//                    }
                }
                double currGainFP = gain.FP(globalContingencies);
                double currGainFN = gain.FN(globalContingencies);

                //FIXME iter only on the not seen documents
                for (int docId = 0; docId < testSize; docId++) {
                    if (microAlreadySeen.contains(docId)) {
                        continue;
                    }
                    Iterator<Entry<Short, ClassifierRangeWithScore>> iterator = classification.getDocumentScoresAsSet(docId).iterator();
                    while (iterator.hasNext()) {
                        Entry<Short, ClassifierRangeWithScore> next = iterator.next();
                        int catId = catMap.get(next.getKey());
                        ClassifierRangeWithScore value = next.getValue();
                        // the current gain has to be set to allow an update of the utilities
                        if (value.score > value.border) {
                            microUtilities[docId][catId] = currGainFP * probabilities[docId][catId];
                        } else if (value.score < value.border) {
                            microUtilities[docId][catId] = currGainFN * probabilities[docId][catId];
                        } else {
                            //microUtilities[docId][catId] = 1.0 * probabilities[docId][catId];
                        }
                    }
                }
            }
        }
        microRankTable.clear();
        //FIXME iter only on the not seen documents
        for (int docId = 0; docId < testSize; docId++) {
            if (!microAlreadySeen.contains(docId)) {
                double sum = 0.0;
                for (int i = 0; i < microUtilities[docId].length; i++) {
                    sum += microUtilities[docId][i];
                }
                microRankTable.put(docId, sum);
            }
        }
        microRank = null;
        return microRankTable;
    }
 
开发者ID:jatecs,项目名称:jatecs,代码行数:56,代码来源:Incremental.java


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