自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 罗马数字_ 转整数13

题目: 代码一: 思路: 1)先找到字符串中的大的子串,统计个数 * 对应的数值 -> 加入求和list,找到后用“”空字符替换, 2)再对更小的子串,进行搜索

2019-03-30 20:53:52 433

原创 回文数

题目: 分析: 方法二:直接把一个整数 --> 翻转为另一个整数over,利用整除与去模,快速简单

2019-03-30 15:31:30 88

原创 python 赋值,浅拷贝,深拷贝

感谢前辈:学习连接 来自:图解Python深拷贝和浅拷贝 总结: 本文介绍了对象的赋值和拷贝,以及它们之间的差异: Python中对象的赋值都是进行对象引用(内存地址)传递 使用copy.copy(),可以进行对象的浅拷贝,它复制了对象,但对于对象中的元素,依然使用原始的引用. 如果需要复制一个容器对象,以及它里面的所有元素(包含元素的子元素),可以使用copy.deepcopy()进...

2019-03-30 14:45:14 194

原创 7. Reverse Integer

题目: 答案: 总结: 1)# 自己写的方法:能用,但不够好, # 1) 没有考虑越界 # 2)采用字符串方式操作,感觉有点啰嗦 2)# 正确的姿势,利用 10进制,移动位置来操作,方便快捷! # @TIME : 2019/3/28 下午11:14 # @File : Reverse_integer.py # 自己写的方法:能用,但不够好, # 1)...

2019-03-29 08:56:25 75

原创 python 动态绑定属性方法

import types # 定义类 class Person(object): num = 0 def __init__(self, name, age=None): self.name = name self.age = age def eat(self): print('eat food') # 定义实例...

2019-03-28 19:41:25 429

转载 crf-lijie

import torch import torch.autograd as autograd import torch.nn as nn import torch.optim as optim torch.manual_seed(1) def argmax(vec): # return the argmax as a python int _, idx = torch.max...

2019-03-20 10:02:30 115

转载 crf_lianxi

crf: # @TIME : 2019/3/17 下午10:52 # @File : chainer_implementation.py # 参考:https://github.com/createmomo/CRF-Layer-on-the-Top-of-BiLSTM import numpy as np import chainer import chainer.links as ...

2019-03-18 08:32:37 149

原创 lianxi

代码 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim torch.manual_seed(1) # 1) 准备数据 def prepare_sentence(seq, to_ix): idx = [to_ix[w] for w in seq...

2019-03-08 21:59:59 202

原创 lstm parctice

代码: # @TIME : 2019/3/5 上午8:07 # @File : LSTM_3_5.py import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim torch.manual_seed(1) # # 0) 定义 input 3, output ...

2019-03-07 09:03:17 145

原创 merge_intervals

合并区间 python class Interval(object): def __init__(self, s=0, e=0): self.start = s self.end = e class Solution(object): def merge(self, intervals): """ :...

2019-03-05 12:00:12 69

原创 fuxi cbow

# @TIME : 2019/3/4 上午00:38 # @File : CBOW_2.py import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class CBOW(nn.Module): def __init__(self, vocab_si...

2019-03-04 08:30:26 99

转载 CBOW 更新

代码: import torch import torch.nn as nn import numpy as np def make_context_vector(context, word_to_ix): idxs = [word_to_ix[w] for w in context] return torch.tensor(idxs, dtype=torch.long) ...

2019-03-02 16:40:11 419

原创 word-embedding

代码 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim torch.manual_seed(1) CONTEXT_SIZE = 2 EMBEDDING_DIM = 30 EPOCH = 100 VERVOSE = 5 # 0) 文本分开 corpus_...

2019-03-02 16:30:23 323

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除