This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from concurrent import futures | |
import pymongo | |
from lxml import etree | |
import datetime | |
MAX_WORKERS = 8 | |
def get(url): | |
session = requests.session() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
using namespace std; | |
// 使用搜索前先排序 | |
int main(){ | |
int A[10] = {1,1,2,3,4,5,6,10,9,15}; | |
int *pos; | |
int idx; | |
bool h; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
#y=2 * (x1) + (x2) + 3 | |
rate = 0.001 | |
x_train = np.array([ [1, 2], [2, 1], [2, 3], [3, 5], [1, 3], [4, 2], [7, 3], [4, 5], [11, 3], [8, 7] ]) | |
y_train = np.array([7, 8, 10, 14, 8, 13, 20, 16, 28, 26]) | |
x_test = np.array([ [1, 4], [2, 2], [2, 5], [5, 3], [1, 5], [4, 1] ]) | |
a = np.random.normal() | |
b = np.random.normal() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
state = tf.Variable(0, name='test') # 变量 | |
one = tf.constant(1) # 张量 | |
new_value = tf.add(state, one) | |
update = tf.assign(state, new_value) #更新 new_value 替换state | |
init = tf.global_variables_initializer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
SERVER = '120.79.9.80' | |
PORT = 27017 | |
DB_NAME = 'ex-rank' | |
COLLECTION = 'rank' | |
client = pymongo.MongoClient(SERVER, PORT) | |
db = client[DB_NAME] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
files = tf.train.match_filenames_once("train.tfrecord") | |
filename_queue = tf.train.string_input_producer(files, shuffle=False) | |
reader = tf.TFRecordReader() | |
_, serialized_example = reader.read(filename_queue) |