Examples of Vec


Examples of pr.lib.Vec

        set(p);
        for (int i = 0; i < steps; i++) {
            int[] pSpotsScores = new int[4];
            for (int j = 0; j < 4; j++) {
                Dir pd = d.turn(Turn.values()[j]);
                Vec pHallSpot = p.InDirection(pd);
                Vec pSpot = pHallSpot.InDirection(pd);

                if (pSpot.distanceTo(world.midpoint) >= world.width / 2) {
                    //Debug.log(pSpot+" " + j+ " is out of bounds! ");
                    pSpotsScores[j] = 0;
                    continue;
                }
View Full Code Here

Examples of pr.lib.Vec

    }

    private void make(long seed) {
        rng.setSeed(seed);
        map = new boolean[world.height][world.width];
        Vec start = world.midpoint;
        int steps = world.width * world.height / (4 * 6);

        int baseScore = 10;
        int noRepeatScore = 10000;
        int noBackTrackScore = -5;
        int noTurnScore = 20;
        int radius = world.width / 2 - 2;

        randomWalk(start, Dir.East, steps, baseScore, noRepeatScore, noBackTrackScore, noTurnScore);

        for (Dir d : Dir.dirs) {
            Vec startPoint = world.midpoint.InDirection(d, d == Dir.North ? radius + 2 : radius);
            randomWalk(startPoint, Dir.East, steps, baseScore, noRepeatScore, noBackTrackScore, noTurnScore);
        }
    }
View Full Code Here

Examples of pr.lib.Vec

        length = astar(map, world.midpoint, world.getGoal());
        world.setMessage(length + "," + seed + "," + score());

        Iterator<Vec> vi = world.iterator();
        while (vi.hasNext()) {
            Vec p = vi.next();
            if (!get(p)) {
                world.makeBlock(blockType, p);
            }
        }
    }
View Full Code Here

Examples of scalaSci.Vec

           sig = truncSig;
       }
       double []  result;
         result = fftMag(sig);

         return new Vec(result);
        }           
View Full Code Here

Examples of water.fvec.Vec

      throw new IllegalArgumentException("vpredict cannot be class labels, expect probabilities.");
  }

  public void execImpl() {
    init();
    Vec va = null, vp;
    try {
      va = vactual.toEnum(); // always returns TransfVec
      vp = vpredict;
      // The vectors are from different groups => align them, but properly delete it after computation
      if (!va.group().equals(vp.group())) {
        vp = va.align(vp);
      }
      // compute thresholds, if not user-given
      if (thresholds != null) {
        sort(thresholds);
        if (ArrayUtils.minValue(thresholds) < 0) throw new IllegalArgumentException("Minimum threshold cannot be negative.");
        if (ArrayUtils.maxValue(thresholds) > 1) throw new IllegalArgumentException("Maximum threshold cannot be greater than 1.");
      } else {
        HashSet hs = new HashSet();
        final int bins = (int)Math.min(vpredict.length(), 200l);
        final long stride = Math.max(vpredict.length() / bins, 1);
        for( int i=0; i<bins; ++i) hs.add(new Float(vpredict.at(i*stride))); //data-driven thresholds TODO: use percentiles (from Summary2?)
        for (int i=0;i<51;++i) hs.add(new Float(i/50.)); //always add 0.02-spaced thresholds from 0 to 1

        // created sorted vector of unique thresholds
        thresholds = new float[hs.size()];
        int i=0;
        for (Object h : hs) {thresholds[i++] = (Float)h; }
        sort(thresholds);
      }
      // compute CMs
      aucdata = new AUCData().compute(new AUCTask(thresholds,va.mean()).doAll(va,vp).getCMs(), thresholds, va.factors(), threshold_criterion);
    } finally {       // Delete adaptation vectors
      if (va!=null) DKV.remove(va._key);
    }
  }
View Full Code Here

Examples of water.fvec.Vec

      throw new IllegalArgumentException("Predicted vector cannot be categorical for regression scoring.");
  }

  public void execImpl() {
    init();
    Vec va = null,vp = null, avp = null;
    try {
      if (classification) {
        // Create a new vectors - it is cheap since vector are only adaptation vectors
        va = vactual .toEnum(); // always returns TransfVec
        actual_domain = va.factors();
        vp = vpredict.toEnum(); // always returns TransfVec
        predicted_domain = vp.factors();
        if (!Arrays.equals(actual_domain, predicted_domain)) {
          domain = ArrayUtils.domainUnion(actual_domain, predicted_domain);
          int[][] vamap = Model.getDomainMapping(domain, actual_domain, true);
          va = TransfVec.compose( (TransfVec) va, vamap, domain, false ); // delete original va
          int[][] vpmap = Model.getDomainMapping(domain, predicted_domain, true);
          vp = TransfVec.compose( (TransfVec) vp, vpmap, domain, false ); // delete original vp
        } else domain = actual_domain;
        // The vectors are from different groups => align them, but properly delete it after computation
        if (!va.group().equals(vp.group())) {
          avp = vp;
          vp = va.align(vp);
        }
        cm = new CM(domain.length).doAll(va,vp)._cm;
      } else {
        mse = new CM(1).doAll(vactual,vpredict).mse();
      }
View Full Code Here

Examples of water.fvec.Vec

    if( !val.isFrame() ) throw new IllegalArgumentException("Not a Frame");
    Frame fr = val.get();

    // Peel out an optional column; restrict to this column
    if( column != null ) {
      Vec vec = fr.vec(column);
      if( vec==null ) throw new IllegalArgumentException("Column "+column+" not found in frame "+key);
      fr = new Frame(new String[]{column}, new Vec[]{vec});
    }

    f._fr = fr;
View Full Code Here

Examples of water.fvec.Vec

  /** Return a single column from the frame. */
  protected Schema column(int version, Frames f) { // TODO: should return a Vec schema
    Frame frame = getFromDKV(f.key);

    // TODO: We really want to return a different schema here!
    Vec vec = frame.vec(f.column);
    if (null == vec)
      throw new IllegalArgumentException("Did not find column: " + f.column + " in frame: " + f.key.toString());

    Vec[] vecs = { vec };
    String[] names = { f.column };
View Full Code Here

Examples of water.fvec.Vec

    return this.schema(version).fillFromImpl(f);
  }

  protected FramesBase columnSummary(int version, Frames frames) {
    Frame frame = getFromDKV(frames.key);
    Vec vec = frame.vec(frames.column);
    if (null == vec)
      throw new IllegalArgumentException("Did not find column: " + frames.column + " in frame: " + frames.key.toString());

    // Compute second pass of rollups: the histograms.  Side-effects the Vec.
    // TODO: side effects, ugh.
View Full Code Here

Examples of water.fvec.Vec

    _adaptedValidation = av[0];
//    gtrash(av[1]); // delete this after computation
    if (_fromValid2CM!=null) {
      assert classification : "Validation response transformation should be declared only for classification!";
      assert _fromModel2CM != null : "Model response transformation should exist if validation response transformation exists!";
      Vec tmp = _validResponse.toEnum();
      _adaptedValidationResponse = tmp.makeTransf(_fromValid2CM, getCMDomain()); // Add an original response adapted to CM domain
//      gtrash(_adaptedValidationResponse); // Add the created vector to a clean-up list
//      gtrash(tmp);
    }
  }
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.