in tensorfow , you could take afvantage of tf.contrib API to implement the leanr mode prediction,

even we know the deep leaning power , leanr model is always the first method you should try before you take on hands of deep leanring .

Tensorflow has two kind of leanr regression : logisitc regression and classification.


train a linear model to classify instances into one of multiple possible classes. When number of possible classes is 2, this is binary classification.


Train a linear regression model to predict label value given observation of feature values.


tf.contrib.learn.DNNClassifier: 深度神经网络分类器



其中如何将数字 或者类别进行转化,下面这个列子就是自动将类别转化成稀疏矩阵

gender = tf.contrib.layers.sparse_column_with_keys(
  column_name="gender", keys=["Female", "Male"])

education = tf.contrib.layers.sparse_column_with_hash_bucket("education", hash_bucket_size=1000)
这样的话 系统会自动分配。 

对于实数  也可以直接输入 但是一般需要做tensor转化的工作 利用:
age = tf.contrib.layers.real_valued_column("age")
age_buckets = tf.contrib.layers.bucketized_column(age, boundaries=[18, 25, 30, 35, 40, 45, 50, 55, 60, 65])
education_x_occupation = tf.contrib.layers.crossed_column([education, occupation], hash_bucket_size=int(1e4))


Tensorflow with a new kind of method to do classfy. 

DNN combines with leanr model .