03 2018 档案
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0.
阅读全文
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -
阅读全文
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g
阅读全文
摘要:例如: python dig_ip.py 8264.comRecursive name lookup (simulates dig)...8264.com cname is qaz2d84guo7uz5q2.gfnormal01at.com.[u'121.29.18.91'] =>IP地址 pyth
阅读全文
摘要:Given a Binary Search Tree (BST) with the root node root, return the minimum difference between the values of any two different nodes in the tree. Exa
阅读全文
摘要:Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t
阅读全文
摘要:最近DGA检出了一堆阿里高防的域名,例如:u3mbyv2siyaw2tnm.gfnormal09aq.com,然后专门查找了下相关文档。 例如 8264.com 这个网站启用了aliyun的高防DDoS。 dig 8264.com 可以看到:; <<>> DiG 9.10.3-P4-Ubuntu <
阅读全文
摘要:#1 - Network Stresser - http://networkstresser.com#2 - Lifetime Booter - http://lifetimeboot.com#3 - Power Stresser - http://powerstresser.com#4 - Dar
阅读全文
摘要:恶意域名指传播蠕虫、病毒和特洛伊木马或是进行诈骗、色情内容传播等不法行为的网站域名。 恶意域名指传播蠕虫、病毒和特洛伊木马或是进行诈骗、色情内容传播等不法行为的网站域名。本文面临能够的挑战,就是恶意网站经营者所使用的各种技术。近年来,FFSN和DGA技术使得网络攻击更加隐蔽,隐患更难被清除。 现网发
阅读全文
摘要:前言 cloudflare 是一家国外的 CDN 加速服务商,还是很有名气的。提供免费和付费的加速和网站保护服务。以前推荐过的百度云加速的国外节点就是和 cloudflare 合作使用的 cloudflare 的节点。 cloudflare 提供了不同类型的套餐,即使是免费用户,cloudflare
阅读全文
摘要:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function
阅读全文
摘要:Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the absolute difference between the sum of all left subt
阅读全文
摘要:多线程 from:https://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386832360548a6491f20c62d427287739fcfa5d5be1f000 import
阅读全文
摘要:Find the sum of all left leaves in a given binary tree. Example: 更简洁的写法: 迭代解法: 另外也可以在迭代过程中绕过叶子结点:
阅读全文
摘要:Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident
阅读全文
摘要:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans
阅读全文
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple
阅读全文
摘要:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Roman Numerals Chart M=1000 D = 500 I 1 XX
阅读全文
摘要:import re pattern = re.compile( r'^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|' r'([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|' r'([a-zA-Z0-9][-_.a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\.' r'([a...
阅读全文
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
摘要:An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr,
阅读全文
摘要:https://blog.csdn.net/qtlyx/article/details/50780400 最后的效果就是这样的。很明显可以看到,左下角那个有点像三角函数的关系,Pearson系数(就是线性相关系数)为0,而MIC则有0.8。 摘自:http://tech.ifeng.com/a/20
阅读全文
摘要:Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n
阅读全文
摘要:For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now i
阅读全文
摘要:Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operation is repres
阅读全文
摘要:Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element
阅读全文
摘要:Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example:
阅读全文
摘要:先看看线索二叉树 n个结点的二叉链表中含有n+1(2n-(n-1)=n+1)个空指针域。利用二叉链表中的空指针域,存放指向结点在某种遍历次序下的前驱和后继结点的指针(这种附加的指针称为"线索")。 对于n个结点的二叉树,在二叉链存储结构中有n+1个空链域,利用这些空链域存放在某种遍历次序下该结点的前
阅读全文
摘要:Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all
阅读全文
摘要:以下是一段简单的闭包代码示例: 博客园 首页 新随笔 联系 订阅 管理 随笔-80 文章-0 评论-2 博客园 首页 新随笔 联系 订阅 管理 随笔-80 文章-0 评论-2 随笔-80 文章-0 评论-2 python中global 和 nonlocal 的作用域 python引用变量的顺序: 当
阅读全文
摘要:RESCALING attribute data to values to scale the range in [0, 1] or [−1, 1] is useful for the optimization algorithms, such as gradient descent, that a
阅读全文
摘要:python利用决策树进行特征选择(注释部分为绘图功能),最后输出特征排序: 其中, 1.13. Feature selection The classes in the sklearn.feature_selection module can be used for feature selecti
阅读全文
摘要:关于不均衡数据的处理方法 (1)Class Imbalance Problem (2)不平衡数据下的机器学习方法简介 (3)8大策略让你对抗机器学习数据集里的不均衡数据 (4)Quora上面的解答:https://www.quora.com/In-classification-how-do-you-
阅读全文
摘要:基于dns lib的,https://github.com/andreif/dnslib 有:https://www.cnblogs.com/anpengapple/p/5664500.html https://github.com/anpengapple/apple_dns https://git
阅读全文
摘要:dns tunnel确认方法,查询子域名最终的解析地址: 使用方法:python dig_trace.py "<7cf1e56b 67fc90f8 caaae86e 0787e907>.nsconcreteblock.info" anySelected root name server: 192.2
阅读全文
摘要:install_dir=/usr/local/anaconda3 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # script dir bash $DIR/Anaconda3-5.0.1-Linux-x86_64.sh -b -p $install_dir $install_dir/bin/conda install -...
阅读全文
摘要:localhost:~ # easy_install uncompyle6-3.0.1-py3.6.eggProcessing uncompyle6-3.0.1-py3.6.eggCopying uncompyle6-3.0.1-py3.6.egg to /root/anaconda3/lib/py
阅读全文
摘要:Python工程的编译、合并、打包、发布 from:https://my.oschina.net/bfbd/blog/864310 from:https://my.oschina.net/bfbd/blog/864310 from:https://my.oschina.net/bfbd/blog/8
阅读全文
摘要:代码如下: 结果: ('Terminating training at the end of epoch', 175)Training Step: 309936 | total loss: 0.00695 | time: 4.371s| Adam | epoch: 176 | loss: 0.006
阅读全文
摘要:pandas 绘图 结果: Index(['label', 'flow_cnt', 'len(srcip_arr)', 'len(dstip_arr)', 'subdomain_num', 'uniq_subdomain_ratio', 'np.average(dns_request_len_arr
阅读全文
摘要:We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example,
阅读全文
摘要:We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N
阅读全文
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep
阅读全文
摘要:from:http://blog.csdn.net/m0_38061927/article/details/77198990 官方文档中给出的用法是 sklearn.metrics.confusion_matrix(y_true, y_pred, labels=None, sample_weight
阅读全文
摘要:>>> rdd = sc.parallelize([("bone", 231), ("bone", 21213), ("jack",1)]) >>> rdd.groupByKey().map(lambda x: sum(x[1])).collect()[1, 21444]>>> rdd.groupB
阅读全文
摘要:拿来主义:看我的代码,我是在模型acc和验证数据集val_acc都达到99.8%时候才终止训练。 The EarlyStoppingCallback Class I show a proof-of-concept version of early stopping below. This is th
阅读全文
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E
阅读全文
摘要:from:https://www.zhihu.com/question/49346370 Harick from:https://www.zhihu.com/question/49346370 Harick from:https://www.zhihu.com/question/49346370 H
阅读全文
摘要:pyminifier Pyminifier is a Python code minifier, obfuscator, and compressor. Note For the latest, complete documentation: http://liftoff.github.io/pym
阅读全文
摘要:from:https://www.cnblogs.com/Jochebed/p/5804325.html 总结 此篇博文给特定需求的人群使用,通过CNAME的某些特征串,确定其使用的是哪家CDN,大多是国外的CDN,国内的CDN厂商只有几个,格式为:【来源地址】+【截图】+【猜测的特征串】,整体博文
阅读全文
摘要:Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th
阅读全文
摘要:X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotate
阅读全文
摘要:Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example: Given a = 1 and b = 2, return 3. 只能位运算: 0x011
阅读全文
摘要:Given 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, n]
阅读全文
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv
阅读全文
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo
阅读全文
摘要:from:https://stackoverflow.com/questions/41616292/how-to-load-and-retrain-tflean-model This is to create a graph and save it To reload and retrain or
阅读全文
摘要:理解dropout from:http://blog.csdn.net/stdcoutzyx/article/details/49022443 http://www.cnblogs.com/tornadomeet/p/3258122.html 开篇明义,dropout是指在深度学习网络的训练过程中,
阅读全文
摘要:正则化方法:L1和L2 regularization 本文是《Neural networks and deep learning》概览 中第三章的一部分,讲机器学习/深度学习算法中常用的正则化方法。(本文会不断补充) 正则化方法:防止过拟合,提高泛化能力 在训练数据不够多时,或者overtraini
阅读全文
摘要:学习率如何影响训练? from:https://www.jiqizhixin.com/articles/2017-11-17-2 深度学习模型通常由随机梯度下降算法进行训练。随机梯度下降算法有许多变形:例如 Adam、RMSProp、Adagrad 等等。这些算法都需要你设置学习率。学习率决定了在一
阅读全文
摘要:机器学习算法中如何选取超参数:学习速率、正则项系数、minibatch size 本文是《Neural networks and deep learning》概览 中第三章的一部分,讲机器学习算法中,如何选取初始的超参数的值。(本文会不断补充) 学习速率(learning rate,η) 运用梯度下
阅读全文
摘要:Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at
阅读全文
摘要:拿来主义: 参考:https://www.cnblogs.com/yangdonghao/p/7921468.html 1、模块的定义: 模块定义:用来逻辑上组织python代码(变量、函数、类、逻辑;目的是:实现一个功能),本质就是.py结尾的python文件。 补充: 包的定义:用来从逻辑组织模
阅读全文
摘要:如何选择正确的激活函数? 现在我们已经了解了这么多的激活函数,接下来就需要分析在哪种情况下应该使用哪种激活函数了。激活函数好或坏,不能凭感觉定论。然而,根据问题的性质,我们可以为神经网络更快更方便地收敛作出更好的选择。 用于分类器时,Sigmoid函数及其组合通常效果更好。 由于梯度消失问题,有时要
阅读全文
摘要:You are given a data structure of employee information, which includes the employee's unique id, his importance value and his direct subordinates' id.
阅读全文
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like:
阅读全文
摘要:Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of
阅读全文
摘要:Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible stri
阅读全文
摘要:from:http://blog.csdn.net/xbinworld/article/details/44901865 需要的背景知识 要学习RBM需要的一些基本的统计学习基础,包括贝叶斯定理,随机采样方法(Gibbs sampling)等。这些可以翻阅我之前写的一些博文可以看到相关的介绍,在本文
阅读全文
摘要:1.初识Auto Encoder1986 年Rumelhart 提出自动编码器的概念,并将其用于高维复杂数据处理,促进了神经网络的发展。自编码神经网络是一种无监督学习算法,它使用了反向传播算法,并让目标值等于输入值,比如 。图1是一个自编码神经网络的示例。 自动编码器(autoencoder) 是神
阅读全文
摘要:自动编码器是一种有三层的神经网络:输入层、隐藏层(编码层)和解码层。该网络的目的是重构其输入,使其隐藏层学习到该输入的良好表征。 自动编码器的目标是学习函数 h(x)≈x。换句话说,它要学习一个近似的恒等函数,使得输出 x^ 近似等于输入 x。自动编码器属于神经网络家族,但它们也和 PCA(主成分分
阅读全文
摘要:Invert a binary tree. to 解法1: 本质是输的先序遍历 解法2,上述DFS的迭代解法: 解法3,使用BFS:
阅读全文
摘要:拿来主义: 解释如下: timestamp转换为datetime 要把timestamp转换为datetime,使用datetime提供的fromtimestamp()方法: 注意到timestamp是一个浮点数,它没有时区的概念,而datetime是有时区的。上述转换是在timestamp和本地时
阅读全文
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length
阅读全文
摘要:Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l
阅读全文
摘要:Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number of set bits in their binary representation
阅读全文
摘要:Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime comple
阅读全文
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston
阅读全文
摘要:Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: 5 O
阅读全文
摘要:Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi
阅读全文
摘要:高级语法 除了像上面介绍的 [x ** 2 for x in L] 这种基本语法之外,列表推导式还有一些高级的扩展。 4.1. 带有if语句 我们可以在 for 语句后面跟上一个 if 判断语句,用于过滤掉那些不满足条件的结果项。 例如,我想去除列表中所有的偶数项,保留奇数项,可以这么写: >>>
阅读全文
摘要:Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Note: 解法1: 精简版: 解法2: DFS 使用一个数组
阅读全文
摘要:You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1'
阅读全文
摘要:You 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/ve
阅读全文
摘要:You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Each round's operation is permane
阅读全文
摘要:In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.
阅读全文
摘要:Python:SMOTE算法 直接用python的库, imbalanced-learn imbalanced-learn is a python package offering a number of re-sampling techniques commonly used in dataset
阅读全文
摘要:迭代一次,acc是98.5%多一点。 如果使用: acc是95%多一点点。 使用类似 vgg的模型, https://github.com/AhmetHamzaEmra/tflearn/blob/master/examples/images/VGG19.py acc是98.5%多一点,稍微比第一种模
阅读全文
摘要:参考:https://stackoverflow.com/questions/37674306/what-is-the-difference-between-same-and-valid-padding-in-tf-nn-max-pool-of-t If you like ascii art: "V
阅读全文
摘要:神经网络结构设计指导原则 原文 http://blog.csdn.net/ybdesire/article/details/52821185 原文 http://blog.csdn.net/ybdesire/article/details/52821185 下面这个神经网络结构设计指导原则是Andr
阅读全文
摘要:A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given an M x N matrix, return True if and only if the m
阅读全文
摘要:一些先进的网络结构: # https://github.com/tflearn/tflearn/blob/master/examples/images/highway_dnn.py # -*- coding: utf-8 -*- """ Deep Neural Network for MNIST d
阅读全文
摘要:积神经网络(CNN)的参数优化方法 from:http://blog.csdn.net/u010900574/article/details/51992156 著名: 本文是从 Michael Nielsen的电子书Neural Network and Deep Learning的深度学习那一章的卷
阅读全文
摘要:批标准化(Bactch Normalization,BN)是为了克服神经网络加深导致难以训练而诞生的,随着神经网络深度加深,训练起来就会越来越困难,收敛速度回很慢,常常会导致梯度弥散问题(Vanishing Gradient Problem)。 统计机器学习中有一个经典的假设:Source Doma
阅读全文
摘要:tflearn里 例子 https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_mnist.py LRN是放到pool后面,全连接层前面。 # Building convolutional network netw
阅读全文
摘要:Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of th
阅读全文
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe
阅读全文
摘要:也许你查询某个大型公司域名whios信息时,常常会发现很多这些大型公司的域名都在一家名为MarkMonitor的公司注册,那么markmonitor是家什么样的公司呢? MarkMonitor是一家从事互联网品牌保护的软件和服务公司,成立于1999年,总部位于美国加利福尼亚州旧金山,2012年7月被
阅读全文
摘要:144. Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree [1,null,2,
阅读全文
摘要:使用图聚类方法:Malware Classification using Graph Clustering 见 https://github.com/rahulp0491/Malware-Classifier 代码参考:https://github.com/bindog/ToyMalwareClas
阅读全文
摘要:Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might
阅读全文
摘要:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below. Examp
阅读全文
摘要:Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". class Solution(object): def
阅读全文
摘要:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. E
阅读全文
摘要:网络安全中机器学习大合集 from:https://github.com/jivoi/awesome-ml-for-cybersecurity/blob/master/README_ch.md#-datasets 历年来那些与网络安全中机器学习相关最好的工具与资源 目录 数据集 论文 书籍 演讲 教
阅读全文
摘要:动态域名是因应网络远程访问的需要而产生的一项应用技术。因为没有固定IP,只能运用二级域名来应对经常变化的IP,动态域名的由来因此而产生。 它当前主要应用在:路由器、网络摄像机、带网络监控的硬盘录像机、视频采集卡、企业管理ERP软件、SF软件服务端以及其他所有需要进行网络远程访问的应用中。 动态域名可
阅读全文
摘要:Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. Note: The given inte
阅读全文
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of
阅读全文
摘要:我使用的caffe模型:https://github.com/BVLC/caffe/tree/ea455eb29393ebe6de9f14e88bfce9eae74edf6d/models/bvlc_alexnet 其中,需要下载deploy prototxt文件和caffmodel以供转换模型用。
阅读全文
摘要:A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128
阅读全文
摘要:from kaffe.tensorflow import Network class AlexNet(Network): def setup(self): (self.feed('data') .conv(11, 11, 96, 4, 4, padding='VALID', name='conv1') .lrn...
阅读全文
摘要:seq2seq模型详解 原创 2017年12月25日 09:41:04 标签: seq2seq / 自然语言 / 机器人 原创 2017年12月25日 09:41:04 标签: seq2seq / 自然语言 / 机器人 在李纪为博士的毕业论文中提到,基于生成的闲聊机器人中,seq2seq是一种很常见
阅读全文