LOADING...

加载过慢请开启缓存

loading

Sakana's Blog

小鱼的个人博客(开发中……)

CS50学习心得-Uncertainty/Optimization

2024/10/25

2. Uncertainty

知识点概述

  • 概率
    • 条件概率
    • 随机变量
    • 贝叶斯规则
    • 联合概率
    • 概率规则(定理)
    • 贝叶斯网络
阅读全文

CS50学习心得-Search/Knowledge

2024/10/13

前言

由于CS50自带及其详细的笔记,所以不再赘述。
以下内容仅为CS50学习过程中遇到的问题与心得分享

0.Search

知识点概述

  • 搜索问题
  • 解决搜索问题
阅读全文

CS61B-List

2024/4/15

3-Reference/Recursion

The Golden Rule of Equals(GRoE)

在Java中,值的传递就是bits的传递

  • y=x copies all bits from x into y
    • a/b 指向同一个实例,a改变b也改变
    • a/b 作为整形复制,不相互影响

Reference

讲解引用类型的生成过程,用一些最基础的硬件方面的例子以便于理解

  • Reference Type:引用类型
  • 全零为null,非全零为指针指向地址
    • new shout the location!!!
    • a record the location
阅读全文

CS61B-Java_Start

2024/4/8

特点

  • 强类语言,所有代码都必须为类的一部分
    • 类定义方式“Public class CLASSNAME”
  • 使用 { } 描述开始与结束
  • 结束时使用 ;
  • 想运行的代码必须位于 “public static void main(String[] args)” 之中
  • 使用变量前需要声明,且类型无法强制转化
  • 函数在类之中,并用 “public static” 定义函数(公共静态)
阅读全文

CS61A-Effciency

2024/4/8

23-Efficiency

Memoization

  • 记住之前己算过的结果
def memo(f):
    cache = {}
    def memoized(n):
        if n not in cache:
            cache[n] = f(n)
        return cache[n]
    return memoized 
阅读全文

机器学习李宏毅-0

2024/2/6

机器学习的本质

  • 自动寻找一个函数的能力

类别

  • Regression: The function outputs a scalar
    • 寻找一个具体数值
  • Classification: Given options(class),thr function outputs the correct one
    • 从选项中进行选择
  • Structured Learning: create somrthing with struction
    • 让机器创造具有结构性的输出
阅读全文

CS61A-Inherit

2024/2/5

20-Inheritance

Inherit

  • 两个类相似的情况,可以使用继承
class <name> (<base class>):
    <suite>
  • Dont repeat your self !

    Multiple Inheritance

    • 可以一次继承多个类
阅读全文

CS61A-Object

2024/1/30

17-Generator

Yield

  • 用yield代替return,可以返回多次
  • 返回值是一个iterator
#yield from
for x in a:
    yield a
# 等价于
yield from a
阅读全文

CS61A-Tree

2024/1/11

14-Tree

Construction

image.png

Tree Abstraction

tree( 3, [ tree( 1 ), tree ( 2, [ tree( 1 ), tree( 1 ) ] ) ]

Sum Path

  • 将n作为计数器,用k叠加
def fact_times(n, k):
    if n==0:
        return k
    else:
        return fact_times(n-1, k*n)
阅读全文

CS61A-Sequence

2023/12/27

11-Sequence

  • for < suite > in < expression >
    (for x,y in sequence )

List Comprehensions(迭代式)

  • [ x+1 for x in odds ]
  • [ x for x in odds if 25 % x == 0 ]
  • [ x for x in range(2, n) ]
  • [out_exp_res for out_exp in input_list (if condition) ]
  • [ 表达式 for 变量 in 列表 (条件) ]
阅读全文
头像
Sakana
一度生まれ変わろうとも
また私はここを選ぶんだろう