- 博客(7)
- 收藏
- 关注
原创 几种排序算法的python实现
#!/usr/bin/env python# -*- coding: utf-8 -*-import numpy as npimport randomdef bubblesort(x): """ 冒泡排序 :param x: 待排序list :return: 排序后list """ n = len(x) for ...
2019-08-26 18:59:45
152
原创 栈(添加尾部元素、删除尾部元素、返回尾部元素、返回长度、判空)
import 文件的地址https://blog.youkuaiyun.com/qq_21944445/article/details/99705171# coding:utf-8from linklist import LinkList# 栈class Stack(LinkList): def __init__(self): super().__init__() ...
2019-08-18 17:15:41
501
原创 牛顿法开根号
# coding: utf-8def get_sqrt(x, a=0.0000001): x = float(x) if x < 0: x = -x print('我猜你相求的是'+str(x)+'的根号') x0 = x while abs(x0**2 - x) > a: x0 = x0 / 2 +...
2019-08-18 15:38:27
468
原创 单向不循环链表(创建、遍历、增、删、查找、判空)
# coding: utf-8# 链表节点class Node(object): def __init__(self, item): self.item = item self.next = None# 单向不循环链表class LinkList(object): def __init__(self): self._h...
2019-08-18 15:28:27
214
原创 matrix-based CF(基于矩阵分解的协同过滤算法)
#!/usr/bin/env python# -*- coding: utf-8 -*-"""matrix_based CF"""import numpy as npimport pandas as pdclass CFmatrix(object): def __init__(self, num_feature, num_recommendation): ...
2018-12-08 15:37:25
876
原创 item-based CF(基于物品的协同过滤算法)
#!/usr/bin/env python# -*- coding: utf-8 -*-"""item_based CF"""import numpy as npimport pandas as pdclass CFItem(object): def __init__(self, k): self.top_k = k @staticmeth...
2018-12-07 21:16:15
1479
原创 pytorch实现一阶线性回归
# -*- coding: utf-8 -*- import random import torch import torch.nn as nn from torch.autograd import Variable import torch.optim as optim import numpy as np import mat...
2018-12-06 17:45:03
246
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人