Skip to content

Commit

Permalink
update readme.md and pys
Browse files Browse the repository at this point in the history
  • Loading branch information
burness committed May 7, 2017
1 parent 63ad12e commit 8530533
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
12 changes: 11 additions & 1 deletion machinelearning_toolkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@

### LinearClassifier
### RandomForest
### SVM
### SVM


### Add monitor in wide and deep model
[https://www.tensorflow.org/get_started/monitors](https://www.tensorflow.org/get_started/monitors)

1. add `tf.logging.set_verbosity(tf.logging.INFO)`, then you can log the loss:
![](../images/mltookit_log_00.png)
2. validation_monitor: a bug with input_fn, eval_steps=None gen the bug, set eval_steps =1 would solve it.
![](../images/mltookit_log_01.png)
3. how to set validation_metrics, see the code [tensorflow/contrib/learn/python/learn/metric_spec.py](https://github.com/tensorflow/tensorflow/blob/r1.1/tensorflow/contrib/learn/python/learn/metric_spec.py) here. Specify the prediction_key and labal_key (None maybe the default )
6 changes: 0 additions & 6 deletions machinelearning_toolkit/scripts/linear_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,8 @@
df_train[LABEL_COLUMN].apply(lambda x: '+' in x)).astype(int)
df_test[LABEL_COLUMN] = (
df_test[LABEL_COLUMN].apply(lambda x: '+' in x)).astype(int)
# print df_train.dtypes
dtypess = df_train.dtypes

# print dtypess[CATEGORICAL_COLUMNS]

# print df_train.head(5)
# print df_test.head(5)


def input_fn(df):
# Creates a dictionary mapping from each continuous feature column name (k) to
Expand Down
9 changes: 6 additions & 3 deletions machinelearning_toolkit/scripts/tf-rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,18 @@ def eval_input_fn():
"accuracy":
tf.contrib.learn.MetricSpec(
metric_fn=tf.contrib.metrics.streaming_accuracy,
prediction_key="classes"),
prediction_key='probabilities'
),
"precision":
tf.contrib.learn.MetricSpec(
metric_fn=tf.contrib.metrics.streaming_precision,
prediction_key="classes"),
prediction_key='probabilities'
),
"recall":
tf.contrib.learn.MetricSpec(
metric_fn=tf.contrib.metrics.streaming_recall,
prediction_key="classes")
prediction_key='probabilities'
)
}

hparams = tf.contrib.tensor_forest.python.tensor_forest.ForestHParams(
Expand Down
7 changes: 7 additions & 0 deletions zhihu_code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## how to build a dl model to solve the zhihu verification recognition

**issue 1**

How to gen the random flip text image, it seems that `draw.text(pos, txt, font=self.font, fill=fill)` and the `rotate` are not useful.
Google whether there is a solution to gen the random flip text in a image.
Or I can concat the images (random flip text images) to gen a new Image.

0 comments on commit 8530533

Please sign in to comment.