VGG trained on CIFAR10 data

@see ImageClassifierVggCifar10

@return The classifier and where to download the model
165998
public static ClassifierAndSource vgg_cifar10() {
		List<String> sources = new ArrayList<>();
		sources.add( "http://boofcv.org/notwiki/largefiles/likevgg_cifar10.zip" );

		ClassifierAndSource ret = new ClassifierAndSource();

		ret.data0 = new ImageClassifierVggCifar10();
		ret.data1 = sources;

		return ret;
	}
391392
public static ImageLibrary getInstance() {
    if (instance == null) {
      synchronized (ImageLibrary.class) {
        if (instance == null)
          instance = new ImageLibrary();
      }
    }
    return instance;
  }
878911
public org.tensorflow.framework.CollectionDef.BytesListOrBuilder getBytesListOrBuilder() {
    if (kindCase_ == 2) {
       return (org.tensorflow.framework.CollectionDef.BytesList) kind_;
    }
    return org.tensorflow.framework.CollectionDef.BytesList.getDefaultInstance();
  }
853079
public SVG build() throws SVGParseException {
		if (data == null) {
			throw new IllegalStateException("SVG input not specified. Call one of the readFrom...() methods first.");
		}

		try {
			final SVGHandler handler = new SVGHandler();
			handler.setColorSwap(searchColor, replaceColor, overideOpacity);
			handler.setWhiteMode(whiteMode);
			if (strokeColorFilter != null) {
				handler.strokePaint.setColorFilter(strokeColorFilter);
			}
			if (fillColorFilter != null) {
				handler.fillPaint.setColorFilter(fillColorFilter);
			}

			// SVGZ support (based on https://github.com/josefpavlik/svg-android/commit/fc0522b2e1):
			if(!data.markSupported())
				data = new BufferedInputStream(data); // decorate stream so we can use mark/reset
			try {
				data.mark(4);
				byte[] magic = new byte[2];
				int r = data.read(magic, 0, 2);
				int magicInt = (magic[0] + ((magic[1]) << 8)) & 0xffff;
				data.reset();
				if (r == 2 && magicInt == GZIPInputStream.GZIP_MAGIC) {
					// Log.d(SVGParser.TAG, "SVG is gzipped");
					GZIPInputStream gin = new GZIPInputStream(data);
					data = gin;
				}
			} catch (IOException ioe) {
				throw new SVGParseException(ioe);
			}

			final SVG svg = SVGParser.parse(new InputSource(data), handler);
			return svg;

		} finally {
			if (closeInputStream) {
				try {
					data.close();
				} catch (IOException e) {
					Log.e(SVGParser.TAG, "Error closing SVG input stream.", e);
				}
			}
		}
	}
1248006
public org.tensorflow.framework.GraphDef getGraphDef() {
    return graphDef_ == null ? org.tensorflow.framework.GraphDef.getDefaultInstance() : graphDef_;
  }
550448
def kernel(self):
        
        result = javabridge.static_call(
            "weka/classifiers/KernelHelper", "getKernel",
            "(Ljava/lang/Object;)Lweka/classifiers/functions/supportVector/Kernel;",
            self.jobject)
        if result is None:
            return None
        else:
            return Kernel(jobject=result)
809246
public com.google.cloud.datalabeling.v1beta1.GcsSourceOrBuilder getGcsSourceOrBuilder() {
    if (sourceCase_ == 2) {
      return (com.google.cloud.datalabeling.v1beta1.GcsSource) source_;
    }
    return com.google.cloud.datalabeling.v1beta1.GcsSource.getDefaultInstance();
  }
585197
def _get_optimizer(self):
        
        optim = tf.train.AdagradOptimizer(self.learning_rate)
        gradients = optim.compute_gradients(self.cost)
        if self.log_dir:
            for name, (g, v) in zip(['W', 'C', 'bw', 'bc'], gradients):
                tf.summary.histogram("{}_grad".format(name), g)
                tf.summary.histogram("{}_vals".format(name), v)
        return optim.apply_gradients(gradients)
1053703
public String getSVGPlotURI() {
    if(plotnum < 0) {
      plotnum = ThumbnailRegistryEntry.registerImage(plot);
    }
    return ThumbnailRegistryEntry.INTERNAL_PREFIX + plotnum;
  }
1151553
public InputStream getAvatar() {
        URL url = USER_AVATAR_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
        BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, "GET");
        BoxAPIResponse response = request.send();

        return response.getBody();
    }
429866
public static WorkClassifier getWorkClassifier() {
        HttpDispatcher f = instance.get().get();
        if (f != null)
            return f.workClassifier;

        return null;
    }
159485
public void learnAndSave() {
		System.out.println("======== Learning Classifier");

		// Either load pre-computed words or compute the words from the training images
		AssignCluster<double[]> assignment;
		if( new File(CLUSTER_FILE_NAME).exists() ) {
			assignment = UtilIO.load(CLUSTER_FILE_NAME);
		} else {
			System.out.println(" Computing clusters");
			assignment = computeClusters();
		}

		// Use these clusters to assign features to words
		FeatureToWordHistogram_F64 featuresToHistogram = new FeatureToWordHistogram_F64(assignment,HISTOGRAM_HARD);

		// Storage for the work histogram in each image in the training set and their label
		List<HistogramScene> memory;

		if( !new File(HISTOGRAM_FILE_NAME).exists() ) {
			System.out.println(" computing histograms");
			memory = computeHistograms(featuresToHistogram);
			UtilIO.save(memory,HISTOGRAM_FILE_NAME);
		}
	}
1140296
@GET
    @Path("/guid/{guid}/classification/{classificationName}")
    @Produces(Servlets.JSON_MEDIA_TYPE)
    public AtlasClassification getClassification(@PathParam("guid") String guid, @PathParam("classificationName") final String classificationName) throws AtlasBaseException {
        AtlasPerfTracer perf = null;

        try {
            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.getClassification(" + guid + "," + classificationName + ")");
            }

            if (StringUtils.isEmpty(guid)) {
                throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
            }

            ensureClassificationType(classificationName);
            return entitiesStore.getClassification(guid, classificationName);
        } finally {
            AtlasPerfTracer.log(perf);
        }
    }
103085
public JComponent learn() {
        double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);

        String[] names = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
        if (names[0] == null) {
            names = null;
        }
        
        int[] label = dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
        int min = Math.min(label);
        for (int i = 0; i < label.length; i++) {
            label[i] -= min;
        }

        long clock = System.currentTimeMillis();
        FLD lda = new FLD(data, label, Math.unique(label).length > 3 ? 3 : 2);
        System.out.format("Learn LDA from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);

        double[][] y = lda.project(data);

        PlotCanvas plot = new PlotCanvas(Math.colMin(y), Math.colMax(y));
        if (names != null) {
            plot.points(y, names);
        } else if (dataset[datasetIndex].responseAttribute() != null) {
            int[] labels = dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
            for (int i = 0; i < y.length; i++) {
                plot.point(pointLegend, Palette.COLORS[labels[i]], y[i]);
            }
        } else {
            plot.points(y, pointLegend);
        }

        plot.setTitle("Linear Discriminant Analysis");
        return plot;
    }
636043
public JComponent learn() {
        JPanel pane = new JPanel(new GridLayout(1, 2));
        double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
        String[] labels = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
        if (labels[0] == null) {
            Attribute[] attr = dataset[datasetIndex].attributes();
            labels = new String[attr.length];
            for (int i = 0; i < labels.length; i++) {
                labels[i] = attr[i].getName();
            }
        }

        long clock = System.currentTimeMillis();
        SammonMapping sammon = new SammonMapping(data, 2);
        System.out.format("Learn Sammon's Mapping (k=2) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);

        PlotCanvas plot = ScatterPlot.plot(sammon.getCoordinates(), labels);
        plot.setTitle("Sammon's Mapping (k = 2)");
        pane.add(plot);

        clock = System.currentTimeMillis();
        sammon = new SammonMapping(data, 3);
        System.out.format("Learn Sammon's Mapping (k=3) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);

        plot = ScatterPlot.plot(sammon.getCoordinates(), labels);
        plot.setTitle("Sammon's Mapping (k = 3)");
        pane.add(plot);

        return pane;
    }
664162
public ModelCategory getModelCategory() {
    return (isClassifier() ?
            (nclasses() > 2 ? ModelCategory.Multinomial : ModelCategory.Binomial) :
            ModelCategory.Regression);
  }
840525
def get_mnist_iter(args, kv):
    
    (train_lbl, train_img) = read_data(
            'train-labels-idx1-ubyte.gz', 'train-images-idx3-ubyte.gz')
    (val_lbl, val_img) = read_data(
            't10k-labels-idx1-ubyte.gz', 't10k-images-idx3-ubyte.gz')
    train = mx.io.NDArrayIter(
        to4d(train_img), train_lbl, args.batch_size, shuffle=True)
    val = mx.io.NDArrayIter(
        to4d(val_img), val_lbl, args.batch_size)
    return (train, val)