By Adam Anderson
This write-up assumes you have an general understanding of the TensorFlow programming model, but maybe you haven't kept up to date with the latest library features/standard practices.
By Adam Anderson
This write-up assumes you have an general understanding of the TensorFlow programming model, but maybe you haven't kept up to date with the latest library features/standard practices.
| sdate=$1 #`date -d'-1 days' +"%Y%m%d"` | |
| edate=$2 #`date -d'+0 days' +"%Y%m%d"` | |
| date=$sdate | |
| declare -a date_array=() | |
| #先生成日期数组,然后依次遍历数组中的日期 | |
| while [ $date -ne $edate ];do | |
| echo "date", $date | |
| date_array=("${date_array[@]}" $date) | |
| date=`date -d"$date 1 day" '+%Y%m%d'` | |
| done |
| # coding=utf-8 | |
| # auc值的大小可以理解为: 随机抽一个正样本和一个负样本,正样本预测值比负样本大的概率 | |
| # 根据这个定义,我们可以自己实现计算auc | |
| import random | |
| import time | |
| def timeit(func): | |
| """ | |
| 装饰器,计算函数执行时间 |
| #https://stackoverflow.com/questions/48238113/tensorflow-dynamic-rnn-state | |
| import numpy as np | |
| import tensorflow as tf | |
| n_steps = 2 | |
| n_inputs = 3 | |
| n_neurons = 5 | |
| X = tf.placeholder(dtype=tf.float32, shape=[None, n_steps, n_inputs]) |
| #encoding=utf8 | |
| import copy, numpy as np | |
| import sys | |
| np.random.seed(0) | |
| #RNN code from http://iamtrask.github.io/2015/11/15/anyone-can-code-lstm/ | |
| # compute sigmoid nonlinearity | |
| def sigmoid(x): | |
| output = 1/(1+np.exp(-x)) | |
| return output |
| #执行前先进入root权限 | |
| #安装前要看一下python2.7是否已安装 | |
| #如何判断是否已安装 | |
| #python2.7 | |
| echo "start install python2.7" | |
| rm -r Python-2.7.10 | |
| rm -rf /usr/local/lib/python2.7 | |
| tar xzvf Python-2.7.10.tgz |
| #encoding=gbk | |
| import random | |
| import math | |
| #读取数据集 | |
| def load_data(filename): | |
| dataset = file(filename) | |
| x_input=[] | |
| y_output=[] | |
| for line in dataset: |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| static void print_permutation_r(char S[], int n, int cur, char P[]) | |
| { | |
| int i, j; | |
| if (cur == n) { // 收敛条件 | |
| for (i = 0; i < n; i++) | |
| printf("%c ", P[i]); | |
| printf("\n"); |