victory的博客

长安一片月,万户捣衣声

0%

免费看视频

在视频链接前加wn.run/

机器学习分类的一般步骤

1.get data from file
2.data preprocess
3.get data and label
4.design the model used here
5.train the model
6.validate the model
7.test the model
8.save the model with best accuracy
note: pay more attention on
1)how to deal with the source data that model can process.
In general,the size of the input of the model is [B, C, H, W],
where B is batch size,C is number of channels,H ans W is two dimension of the input data respectively.
2)how to calculate ‘in_features’ of the first fully connected layer`

递归折半查找算法

def recursive_binary_search(arr, low, high, key):
        if low <= high:
                mid = (low + high) // 2
            if arr[mid] == key:
                    return mid
            elif key < arr[mid]:
                    return recursive_binary_search(arr, low, mid-1, key)
            else:
                    return recursive_binary_search(arr, mid+1, high, key)

        return -1

UML中的事物分类

1.结构事物
模型的静态部分,是UML模型中的名词,描述概念或物理元素。
包括:类(class),(接口)interface,协作(collaboration),用例(use case),主动类(active class),构件(component),节点(node)

2.行为事物
模型的动态部分,描述了跨越时间和空间的行为。
包括:交互(interaction),状态机(state machine)

交互:由在特定语境中共同完成一定任务的一组对象之间交换的消息组成,描述一个对象群体的行为或单个操作的行为

状态机:描述了一个对象或一个交互在生命期内响应事件所经历的状态序列

3.分组事物
分组事物是一些由模型分解成的组织部分,最主要的是

4.注释事物
用来描述、说明和标注模型的任何元素,主要是注解

pygame最小开发框架

import pygame, sys

pygame.init()
screen = pygame.display.set_mode((1206, 780))
pygame.display.set_caption("Pygame")

while True:
        for event in pygame.event.get():
                if event.type == pygame.QUIT:
                        sys.exit()

        pygame.display.update()

pygame最小开发框架

python property

class Test(object):
        def __init__(self):
            self.__num = 100

           # def getNum(self):
           #     return self.__num
            #
        # def setNum(self,newNum):
            #     self.__num = newNum

        @property
        def num(self):
                return self.__num

        @num.setter
        def num(self,newNum):
                self.__num = newNum


t = Test()
t.num = 50
print(t.num)

python getattr()函数

描述:getattr()函数用于返回一个对象属性值

参数:
object – 对象
name – 对象属性(字符串)
default – 默认返回值(如果不提供该参数,在没有对应属性时,将触发AttributeError)

实例:
class A(object):
bar = 1

a = A()
print(getattr(a, ‘bar’)) # 获取属性bar值 result:1
print(getattr(a, ‘bar2’)) # 属性bar2不存在,触发异常
print(getattr(a, ‘bar2’, 3) # result:3