Examples of TDoubleArrayList


Examples of gnu.trove.TDoubleArrayList

    this.useValues = useValues;
    this.numFeatures = numFeatures;
    this.numLabels = numLabels;
    this.constraints = new TIntObjectHashMap<MaxEntFLPRConstraint>();
    this.indexCache = new TIntArrayList();
    this.valueCache = new TDoubleArrayList();
  }
View Full Code Here

Examples of gnu.trove.TDoubleArrayList

  TIntArrayList indices;
  TDoubleArrayList values;

  public SparseVector() {
    indices = new TIntArrayList();
    values = new TDoubleArrayList();
  }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

     * specified capacity.
     *
     * @param capacity the initial depth of the stack
     */
    public TDoubleArrayStack( int capacity ) {
        _list = new TDoubleArrayList( capacity );
    }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

     *
     * @param capacity the initial depth of the stack
     * @param no_entry_value value that represents null
     */
    public TDoubleArrayStack( int capacity, double no_entry_value ) {
        _list = new TDoubleArrayList( capacity, no_entry_value );
    }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

     * @param stack the instance to copy
     */
    public TDoubleArrayStack( TDoubleStack stack ) {
        if ( stack instanceof TDoubleArrayStack ) {
            TDoubleArrayStack array_stack = ( TDoubleArrayStack ) stack;
            this._list = new TDoubleArrayList( array_stack._list );
        } else {
            throw new UnsupportedOperationException( "Only support TDoubleArrayStack" );
        }
    }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

   * @param line Line to process
   */
  protected void parseLineInternal(String line) {
    List<String> entries = tokenize(line);
    // Split into numerical attributes and labels
    TDoubleArrayList attributes = new TDoubleArrayList(entries.size());
    LabelList labels = null;

    Iterator<String> itr = entries.iterator();
    for(int i = 0; itr.hasNext(); i++) {
      String ent = itr.next();
      if(!labelIndices.get(i)) {
        try {
          double attribute = Double.parseDouble(ent);
          attributes.add(attribute);
          continue;
        }
        catch(NumberFormatException e) {
          // Ignore attempt, add to labels below.
        }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

    List<LabelList> labels = new ArrayList<LabelList>();
    try {
      for(String line; (line = reader.readLine()) != null; lineNumber++) {
        if(!line.startsWith(COMMENT) && line.length() > 0) {
          List<String> entries = tokenize(line);
          TDoubleList attributes = new TDoubleArrayList(entries.size());
          LabelList labellist = null;
          for(String entry : entries) {
            try {
              double attribute = Double.parseDouble(entry);
              attributes.add(attribute);
            }
            catch(NumberFormatException e) {
              if(labellist == null) {
                labellist = new LabelList(1);
              }
              labellist.add(entry);
            }
          }

          if(dimensionality < 0) {
            dimensionality = attributes.size();
          }
          else if(dimensionality != attributes.size()) {
            throw new IllegalArgumentException("Differing dimensionality in line " + lineNumber + ":" + attributes.size() + " != " + dimensionality);
          }
          vectors.add(ParameterizationFunction.STATIC.newNumberVector(attributes, ArrayLikeUtil.TDOUBLELISTADAPTER));
          labels.add(labellist);
        }
      }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

    this.newGrad = zeros;
    this.dir = zeros;
    this.steepestDescDir = newGrad;

    this.alphas = new double[m];
    this.roList = new TDoubleArrayList(m);
    this.costs = new TDoubleArrayList(m);
    this.sList = new ArrayList<>();
    this.yList = new ArrayList<>();

    this.value = evaluateL1(f);
    this.grad = newGrad;
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

  public static Tuple3<List<String>, DenseDoubleVector, String[]> readTwentyNewsgroups(
      File directory) {
    String[] classList = directory.list();
    Arrays.sort(classList);
    List<String> docList = new ArrayList<>();
    TDoubleArrayList prediction = new TDoubleArrayList();
    String[] nameMapping = new String[classList.length];
    int classIndex = 0;
    for (String classDirString : classList) {
      File classDir = new File(directory, classDirString);
      String[] fileList = classDir.list();
      for (String fileDoc : fileList) {
        try (BufferedReader br = new BufferedReader(new FileReader(new File(
            classDir, fileDoc)))) {
          StringBuilder document = new StringBuilder();
          String l = null;
          while ((l = br.readLine()) != null) {
            document.append(l);
          }
          docList.add(document.toString());
          prediction.add(classIndex);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      nameMapping[classIndex++] = classDirString;
    }

    return new Tuple3<>(docList, new DenseDoubleVector(prediction.toArray()),
        nameMapping);
  }
View Full Code Here

Examples of gnu.trove.list.array.TDoubleArrayList

        return result;
    }

    @Override
    public TDoubleList getAsDoubleArray() {
        TDoubleList result = new TDoubleArrayList(size());
        for (JsonElement element : array) {
            result.add(element.getAsDouble());
        }
        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.