Skip to content

Instantly share code, notes, and snippets.

@iceboal
iceboal / trainCRBM.m
Created March 9, 2014 03:19
Rewrite Peng Qi's code for 1-D CRBM
function [model, output] = trainCRBM(data, params, oldModel)
% TRAINCRBM Trains a convolutional restricted Boltzmann machine
% with the specified parameters.
%
% [model output] = TRAINCRBM(data, params, oldModel)
%
% data should be a structure, containing:
% data.x The input images / pooling states of the previous layer
% of CRBM. This matrix is 4-D the first three dimensions
% define an image (coloum-stored with a color channel),
@iceboal
iceboal / format_tick.m
Created April 13, 2013 19:07
Using LaTeX in Matlab. Author: Alexander Hayes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% BEGIN HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Name: format_tick.m
%
%Usage: [hx,hy] = ...
% format_tick(h,tickx,ticky,tickposx,tickposy,rotx,roty,offset,...
% varargin);
//Map Class
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> {
public void map(LongWritable key, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
21
}
}
//Reduce Class
public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable> {
public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
@iceboal
iceboal / TextPair.java
Created January 3, 2013 04:35
TextPair class for hadoop.
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparable;
public class TextPair implements WritableComparable<TextPair>{
public Text first;