Package org.apache.mahout.classifier.bayes.exceptions

Examples of org.apache.mahout.classifier.bayes.exceptions.InvalidDatastoreException


    Configuration conf = new Configuration();
    String basePath = params.get("basePath");
    try {
      SequenceFileModelReader.loadModel(this, FileSystem.get(new Path(basePath).toUri(), conf), params, conf);
    } catch (IOException e) {
      throw new InvalidDatastoreException(e.getMessage());
    }
    for (String label : getKeys("")) {
      log.info("{} {} {} {}", new Object[] {label,
                                                                   thetaNormalizerPerLabel
                                                                       .get(getLabelID(label)),
View Full Code Here


        return sigma_j.get(getFeatureID(row));
      } else {
        return weightMatrix.getQuick(getFeatureID(row), getLabelID(column));
      }
    } else {
      throw new InvalidDatastoreException("Matrix not found: " + matrixName);
    }
  }
View Full Code Here

      if (index.equals("sigma_jSigma_k")) {
        return sigma_jSigma_k;
      } else if (index.equals("vocabCount")) {
        return featureDictionary.size();
      } else {
        throw new InvalidDatastoreException();
      }
    } else if (vectorName.equals("thetaNormalizer")) {
      return thetaNormalizerPerLabel.get(getLabelID(index)) / thetaNormalizer;
    } else if (vectorName.equals("params")) {
      if (index.equals("alpha_i")) {
        return alphaI;
      } else {
        throw new InvalidDatastoreException();
      }
    } else if (vectorName.equals("labelWeight")) {
      return sigma_k.get(getLabelID(index));
    } else {
      throw new InvalidDatastoreException();
    }
  }
View Full Code Here

  public void initialize() throws InvalidDatastoreException {
    config = new HBaseConfiguration(new Configuration());
    try {
      table = new HTable(config, hbaseTable);
    } catch (IOException e) {
      throw new InvalidDatastoreException(e.getMessage());
    }
    Collection<String> labels = getKeys("thetaNormalizer");
    for (String label : labels) {
      thetaNormalizer = Math.max(thetaNormalizer, Math.abs(getWeightFromHbase(
        BayesConstants.LABEL_THETA_NORMALIZER, label)));
View Full Code Here

      r = getRowFromHbase(name);
    }
   
    if (r == null) {
      log.error("Encountered NULL");
      throw new InvalidDatastoreException("Encountered NULL");
    }
   
    Set<byte[]> labelBytes = r.getNoVersionMap().get(Bytes.toBytes(BayesConstants.HBASE_COLUMN_FAMILY))
        .keySet();
    Set<String> keySet = new HashSet<String>();
View Full Code Here

        return getSigmaJFromHbase(row);
      } else {
        return getWeightFromHbase(row, column);
      }
    } else {
      throw new InvalidDatastoreException();
    }
  }
View Full Code Here

      if (index.equals("vocabCount")) {
        return getVocabCountFromHbase();
      } else if (index.equals("sigma_jSigma_k")) {
        return getSigmaJSigmaKFromHbase();
      } else {
        throw new InvalidDatastoreException();
      }
     
    } else if (vectorName.equals("labelWeight")) {
      return getWeightFromHbase(BayesConstants.LABEL_SUM, index);
    } else if (vectorName.equals("thetaNormalizer")) {
      return getWeightFromHbase(BayesConstants.LABEL_THETA_NORMALIZER, index) / thetaNormalizer;
    } else if (vectorName.equals("params")) {
      if (index.equals("alpha_i")) {
        return alphaI;
      } else {
        throw new InvalidDatastoreException();
      }
    } else {
     
      throw new InvalidDatastoreException();
    }
  }
View Full Code Here

    Configuration conf = new Configuration();
    String basePath = params.get("basePath");
    try {
      SequenceFileModelReader.loadModel(this, FileSystem.get(new Path(basePath).toUri(), conf), params, conf);
    } catch (IOException e) {
      throw new InvalidDatastoreException(e.getMessage());
    }
    for (String label : getKeys("")) {
      log.info("{} {} {} {}", new Object[] {
        label,
        thetaNormalizerPerLabel.get(getLabelID(label)),
View Full Code Here

        return sigmaJ.get(getFeatureID(row));
      } else {
        return weightMatrix.getQuick(getFeatureID(row), getLabelID(column));
      }
    } else {
      throw new InvalidDatastoreException("Matrix not found: " + matrixName);
    }
  }
View Full Code Here

      if ("sigma_jSigma_k".equals(index)) {
        return sigmaJsigmaK;
      } else if ("vocabCount".equals(index)) {
        return featureDictionary.size();
      } else {
        throw new InvalidDatastoreException();
      }
    } else if ("thetaNormalizer".equals(vectorName)) {
      return thetaNormalizerPerLabel.get(getLabelID(index)) / thetaNormalizer;
    } else if ("params".equals(vectorName)) {
      if ("alpha_i".equals(index)) {
        return alphaI;
      } else {
        throw new InvalidDatastoreException();
      }
    } else if ("labelWeight".equals(vectorName)) {
      return sigmaK.get(getLabelID(index));
    } else {
      throw new InvalidDatastoreException();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.classifier.bayes.exceptions.InvalidDatastoreException

Copyright © 2018 www.massapicom. 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.