- 博客(60)
- 收藏
- 关注
原创 【tensorflow】tf.train.get_checkpoint_state
tf.train.get_checkpoint_state函数通过checkpoint文件找到模型文件名。tf.train.get_checkpoint_state(checkpoint_dir,latest_filename=None)该函数返回的是checkpoint文件CheckpointState proto类型的内容,其中有model_checkpoint_path和all_model_...
2018-05-10 15:58:52
37970
27
原创 [leetcode]152. Maximum Product Subarray 最大子序列乘积
题目:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest pro...
2018-04-23 18:55:16
318
原创 【机器学习实战】10.k-means聚类算法(1)
这里主要记录对书上相关程序运行结果的一些展示。程序:# -*- coding: utf-8 -*-"""Created on Fri Mar 30 10:42:00 2018@author: ##"""from numpy import *import matplotlib.pyplot as plt def loadDataSet(filename): ''' ...
2018-03-30 15:17:45
475
1
原创 【机器学习实战】6.支持向量机——简化SMO算法
主体是书上的程序,添加了一个画图函数,查看分类结果。实际上,按照书上的程序,分类结果并不一定好。书上图6-4只是理想结果。程序后附上结果。# -*- coding: utf-8 -*-"""Created on Thu Mar 15 10:26:20 2018@author: ###"""import numpy as npimport matplotlib.pyplot as p...
2018-03-20 17:27:26
817
原创 【机器学习实战】5.Logistic回归(1)
程序:# -*- coding: utf-8 -*-"""Created on Wed Mar 14 14:15:43 2018@author: ###"""import numpy as npimport matplotlib.pyplot as pltdef loadDataSet(): dataMat=[] labelMat=[] fr=open('...
2018-03-14 20:17:51
312
原创 【机器学习实战】11.使用Apriori算法进行关联分析——python3程序
之前费心费力写了一篇,结果没有保存。这一篇主要放上书本上的程序分析及运行结果。 关联分析主要分为:频繁项集生成和关联规则生成1.频繁项集生成——Apriori算法代码:def createC1(dataSet): ''' 构建大小为1的所有候选项的集合,存储不重复的项值 map(function,data)映射函数,在python3中返回一个迭代器,智能循环一...
2018-03-06 17:32:14
4067
3
原创 [leetcode]21. Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1-&g...
2018-03-02 11:05:43
126
原创 【leetcode】70. Climbing Stairs
题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive ...
2018-03-02 10:52:34
137
原创 PAT甲级 1064. Complete Binary Search Tree (30)
题目:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key.
2017-11-22 14:11:03
201
原创 PAT甲级 1063. Set Similarity (25)
题目:Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of d
2017-11-21 13:42:18
186
原创 PAT甲级 1062. Talent and Virtue (25)
题目:About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent
2017-11-21 12:52:22
193
原创 PAT甲级 1061. Dating (20)
题目:Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minute to figure out that those strange stri
2017-11-21 11:07:24
219
原创 PAT甲级 1060. Are They Equal (25)
题目:If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*105 with simple chopping. Now given the number of
2017-11-21 09:57:48
204
原创 PAT甲级 1059. Prime Factors (25)
题目:Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *…*pm^km.Input Specification:Each input file contains o
2017-11-20 17:21:31
209
原创 PAT甲级 1055. The World's Richest (25)
题目:Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on
2017-11-15 15:03:47
172
原创 PAT甲级 1054. The Dominant Color (20)
题目:Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is cal
2017-11-15 13:33:28
176
原创 PAT甲级 1053. Path of Equal Weight (30)
题目:Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to Lis defined to be the sum of the weights of all the nodes along the path
2017-11-15 10:50:34
166
原创 PAT甲级 1052. Linked List Sorting (25)
题目:A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure.
2017-11-15 10:18:08
157
原创 PAT甲级 1051. Pop Sequence (25)
题目:Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequ
2017-11-14 18:20:04
261
原创 PAT甲级 1050. String Subtraction (20)
题目:Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings.
2017-11-14 16:28:35
175
原创 PAT甲级 1049. Counting Ones (30)
题目:The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. For example, given N being 12, there are f
2017-11-14 16:01:09
163
原创 PAT甲级 1048. Find Coins (25)
题目:Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments.
2017-11-14 13:45:11
207
原创 PAT甲级 1047. Student List for Course (25)
题目:Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.
2017-11-14 12:58:34
229
原创 PAT甲级 1046. Shortest Distance (20)
题目:The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each inp
2017-11-13 21:59:41
156
原创 PAT甲级 1045. Favorite Color Stripe (30)
题目:Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remain
2017-11-13 21:19:32
163
原创 PAT甲级 1044. Shopping in Mars (25)
题目:Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can be cut at any
2017-11-13 17:27:15
199
原创 1043. Is It a Binary Search Tree (25)
题目:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key.
2017-11-13 11:31:06
137
原创 PAT甲级 1042. Shuffling Machine (20)
题目:Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where employees collaborate w
2017-11-09 19:33:32
128
原创 PAT甲级 1041. Be Unique (20)
题目:Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who
2017-11-09 18:50:55
190
原创 PAT甲级 1040. Longest Symmetric String (25)
题目:Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is PAT&TAP symmetric?", the longest symmetric sub-string is "s PAT&TAP s", hence
2017-11-09 17:11:37
157
原创 PAT甲级 1038. Recover the Smallest Number (30)
题目:Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87}, we can recover many numbers such like 32-321-32
2017-11-08 12:07:08
218
原创 PAT甲级 1037. Magic Coupon (25)
题目:The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times the value of that
2017-11-08 10:38:34
153
原创 PAT甲级 1036. Boys vs Girls (25)
题目:This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file c
2017-11-07 19:36:34
152
原创 PAT甲级 1035. Password (20)
题目:To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (on
2017-11-07 19:09:57
140
原创 PAT甲级 1034. Head of a Gang (30)
题目:One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is define
2017-11-07 18:34:13
163
原创 PAT甲级 1033. To Fill or Not to Fill (25)
题目:With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Dif
2017-11-07 12:01:38
147
原创 PAT甲级 1031. Hello World for U (20)
题目:Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:h de ll rlowoThat is, the characters m
2017-11-04 20:58:58
190
原创 PAT甲级 1030. Travel Plan (30)
题目:A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shor
2017-11-04 20:05:45
141
原创 PAT甲级 1028. List Sorting (25)
题目:Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two i
2017-10-25 21:38:26
154
原创 PAT甲级 1029. Median (25)
题目:Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} i
2017-10-25 20:47:53
166
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人