- 博客(37)
- 收藏
- 关注
转载 tensorflow layers
0. 基础神经网络 1 数据的呈现(Variable():定义变量): x=np.array([[1,1,1],[1,-8,1],[1,1,1]]) w=tf.Variable(initial_value=x) w=tf.Variable(tf.zeros([3,3])) init=tf.global_variables_i...
2019-06-14 22:05:07
455
转载 tensorflow loss
1.交叉熵(crossentropy) 简介:交叉熵刻画了两个概率分布之间的距离,是分类问题中使用广泛的损失函数。给定两个概率分布p和q,交叉熵刻画的是两个概率分布之间的距离: 公式:H(X=x) = - sum_x( p(x) log( q(x) ) ) api: tf.nn.softmax_cross_entropy_with_logits(labels...
2019-06-14 22:04:33
440
转载 tensorflow model save
一种是传统的Saver类save保存和restore恢复方法 1. TensorFlow模型简介 训练了一个神经网络之后,我们希望保存它以便将来使用。那么什么是TensorFlow模型?Tensorflow模型主要包含我们所培训的网络参数的网络设计或图形和值。因此,Tensorflow模型有两个主要的文件: a) Meta graph: ...
2019-06-14 22:03:48
2246
转载 tensorflow input
TensorFlow输入数据的方法有四种: tf.data API:可以很容易的构建一个复杂的输入通道(pipeline)(首选数据输入方式)(Eager模式必须使用该API来构建输入通道) 在 tf.data 之前,一般使用 QueueRunner,但 QueueRunner 基于 Python 的多线程及队列等,效率不够高,所以 Google发布了tf.data,其...
2019-06-14 22:02:16
1837
1
原创 Offer收割赛25 #1567 偶树分割
Offer收割赛25 #1567描述如果一棵树节点数目是偶数,那么就称这棵树是偶树。给定一棵N个节点的偶树(编号1~N),小Hi想知道他最多可以同时切断多少条边,使得剩下的森林中每一个联通分量都是一棵偶树。例如如下的偶树: 1 / | | \ 2 3 4 5 | 6可以切断
2017-09-07 10:33:16
253
原创 罗马和阿拉伯数字相互转换
之前做#1566 hihocoder 题目遇到了这个基本的问题,卡了一会儿,这里补齐这个问题。参考:http://blog.sina.com.cn/s/blog_7025794a0101397g.htmlhttp://blog.youkuaiyun.com/fightforyourdream/article/details/12934139思路:r2a:
2017-09-06 10:10:06
742
原创 【hihocoder】#1566 : 皇室成员的名字[Offer收割]编程练习赛25
时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Ho正在学习世界历史。他发现历史上很多西方国家的皇室成员的名字都是由英文名字加罗马数字组成的,例如George IV(乔治四世)、William IV(威廉四世)、Elizabeth II(伊丽莎白二世)等。 为了更好的梳理历史脉络,小Ho决定写个程序把历史书上出现过的皇室名字排序
2017-09-05 21:49:47
604
原创 腾讯社交广告“高校算法大赛” Amelie 30th
腾讯2017社交广告大赛中的解决方案,之后代码会陆续更新到上面。https://github.com/oooozhizhi/TencentSocialAdvertising-30th-solutions排名:Amelie 30th. 成绩:0.102001简介:1 我们的特征数量一度达到了100多维,这对我们的机器提出了很高的要求。所幸我们通过各种方法得到了一台
2017-09-02 10:39:42
904
原创 【Leetcode】106. Construct Binary Tree from Inorder and Postorder Traversal
106. Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist
2017-03-01 22:43:20
226
原创 【Leetcode】216. Combination Sum III
216. Combination Sum IIIFind all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of nu
2017-02-27 22:26:41
211
原创 【Leetcode】287. Find the Duplicate Number
287. Find the Duplicate NumberGiven an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that th
2017-02-26 11:27:13
360
原创 【Leetcode】53. Maximum Subarray
53. Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contigu
2017-02-25 17:27:01
217
原创 【Leetcode】380. Insert Delete GetRandom O(1)
380. Insert Delete GetRandom O(1)Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to the set if not already present.re
2017-02-25 16:00:21
300
原创 【Leetcode】442. Find All Duplicates in an Array
442. Find All Duplicates in an ArrayGiven an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in
2017-02-25 12:03:45
253
原创 【Leetcode】495. Teemo Attacking
In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning tim
2017-02-23 22:02:01
256
原创 【Leetcode】227. Basic Calculator II
227. Basic Calculator IIImplement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces
2017-02-23 19:56:02
255
原创 【Leetcode】449. Serialize and Deserialize BST
449. Serialize and Deserialize BSTSerialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitte
2017-02-23 00:03:05
347
原创 【Leetcode】468. Validate IP Address
468. Validate IP AddressWrite a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically represented in dot-decimal notatio
2017-01-17 17:51:57
268
原创 【Leetcode】448. Find All Numbers Disappeared in an Array
448. Find All Numbers Disappeared in an ArrayGiven an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1,
2017-01-16 17:21:25
274
原创 【Leetcode】463. Island Perimeter
463. Island PerimeterYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonall
2017-01-16 11:26:35
231
原创 【Leetcode】475. Heaters
475. HeatersWinter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now, you are given positions of houses and heater
2017-01-16 10:21:11
529
原创 【Leetcode】482. License Key Formatting
482. License Key FormattingNow you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and dashes.
2017-01-15 14:48:03
209
原创 【Leetcode】445. Add Two Numbers II
445. Add Two Numbers IIYou are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add
2017-01-14 13:00:12
271
原创 【Leetcode】476. Number Complement
题目:476. Number ComplementGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is
2017-01-14 12:05:18
403
原创 【Leetcode】454. 4Sum II
问题:454. 4Sum IIGiven four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, a
2017-01-12 20:36:06
233
原创 【Leetcode】48. Rotate Image
题目分析:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Subscribe to see which companies ask
2016-12-02 11:47:53
239
原创 【Leetcode】398. Random Pick Index
问题分析:Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The a
2016-12-01 23:16:44
340
原创 【Leetcode】153. Find Minimum in Rotated Sorted Array
题目分析:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.You may assume no duplicate
2016-12-01 22:22:32
165
原创 【Leetcode】78. Subsets
先上代码:public class Solution { public List> subsets(int[] nums) { List> res = new ArrayList>(); List temp = new ArrayList(); dfs(res,temp,nums,0); return res;
2016-11-30 22:37:45
147
转载 【Leetcode】77. Combinations
先贴代码:转载自:http://blog.youkuaiyun.com/happyaaaaaaaaaaa/article/details/51564160public class Solution { public List> combine(int n, int k) { List> resList = new ArrayList>(); List te
2016-11-30 22:21:45
274
原创 【Leetcode】318. Maximum Product of Word Lengths
方法一:(空间复杂度O(1),时间复杂度O(n^2))很简单的多次遍历的方式:public int maxProduct(String[] words) { int res = 0; boolean flag; for(int i=0;i for(int j=i+1;j if
2016-11-28 22:45:36
275
原创 【Leetcode】22. Generate Parentheses
先贴代码:public class Solution { List aList = new ArrayList(); public List generateParenthesis(int n) { if(n == 0){ return aList; } travel("",n,n);
2016-11-28 21:59:14
279
原创 【leetcode】423. Reconstruct Original Digits from English
这题我们只要统计关键的字符就能够统计出每个单词出现的次数,有写单词需要统计前驱字符才能计算出来首先:具有独特字符的zero/two/six/eightseven(six)/five(seven)four(five)/nine(eight/six/five)/one(zero/two/four)/three(zero/four)public class Solution {
2016-11-28 21:21:06
200
原创 JAVA_性能随笔
在刷Leetcode的时候,遇到了一题数据结构相关的题目(反复往栈中装填数据)。提交的时候顺便看看各个语言的速度:C++和C一骑绝尘而去。之前测试在计算为主的任务中,JAVA的性能与C/C++不相上下~‘’‘随手一记,来日填坑‘’’
2016-11-05 20:48:09
222
转载 JAVA_Enumeration
'''我是python注释君、'''(文章转载自:易百教程 [http:/www.yiibai.com])Enumeration接口定义,通过它可以枚举(获得一次一个)对象集合的元素的方法。这个原有的接口已经被迭代器取代。虽然未过时,枚举被认为是过时的新代码。然而,他是用来通过由旧版的类,如向量和属性定义了几种方法,所使用的其他几个API类,而且目前在应用程序代码中广泛
2016-10-26 22:20:56
254
转载 JAVA_Dictionary类
'''我是Python注释君、'''(文章转载自:易百教程 [http:/www.yiibai.com])一。Dictionary字典是代表一个键/值存储库。给定一个键和值,可以在一个Dictionary对象存储的值。一旦该值被存储,可以使用它的键检索。因此,像一个映射,词典可以被认为是作为键/值对的列表。通过字典中定义的抽象方法如下:
2016-10-26 22:06:36
3666
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人