kch042

@buster

Joined on May 13, 2022

  • Problem Description A tree is defined as an unweighted undirected graph. $$T = (V, E) $$ The diameter of the tree is defined as the longest distance between all pairs of nodes. $$ \text{diameter}(T)=max_{(u, v)\in E} \text{ }d(u, v) $$
     Like  Bookmark
  • Intuition Suppose we are given a sorted array, say $$A = [1, 1, 2, 4, 6, 9]$$ then we can see that all numbers in $A[0:3]$ are smaller than $4$, while all in $A[3:6]$ are equal or greater than $4$. Thus, we can define a predicate, $$f(x) := (x >= 4)$$ Let $B$ be the array of $f(A)$, then $$B = [0, 0, 0, 1, 1, 1]$$
     Like  Bookmark
  • xv6 In xv6, we have per-process pagetables, and the kernel owns a pagetable kernel_pagetable. Whenever switching to kernel mode, we will replace pagetable register w/ kernel_pagetable. Lab In 2020, MIT 6.S081 release a lab that modifies the per-process pagetable such that each process contains two pagetable. pagetable: original pagetable kpagetable: kernel pagetable with user mappings
     Like  Bookmark
  • Range Sum Query Given an array A of size n, and m queries, where each query asks the sum of a range in A. For example, A = [1, 2, 4, 2, 3, 4], and query = [[1, 2], [1, 4]]. The answer to the query[0] is 2+4=6, and 2+4+2+3=11 for query[1]. The naive way to do this is to sum over the range for each query, and this give O(mn) time complexity. Prefix Sum A better way to do this is by precomputing the prefix sum. We will make another array P, where P[i]=A[0]+A[1]+...+A[i]. Moreover, P[i] = P[i-1]+A[i], for i=1 to n-1. So we can compute P in O(n) time.
     Like  Bookmark
  • Contents Introduction3A Pytest Usage Install Naming Run Pytest Pytest Options pytest.ini
     Like  Bookmark
  • Prerequisites python basic concept magic method zip iterable, iterator, generator Introduction When training DL models, it is often needed to preprocess data and find a way to feed data into model. The deep learning library torch provides two utility class torch.utils.Dataset and torch.utils.DataLoader to facilitate preprocessing.
     Like  Bookmark
  • Paper Link Supporting Information Keyword RF, GB, SVM, XGBoost GCN, GAT, Attentive FP Transfer Learning Shapley additive explanations (SHAP) method matched molecular pair analysis (MMPA)
     Like  Bookmark
  • Background When training deep learning model, we often use Nvidia gpu on the server to accelerate the training, and use docker container to avoid messing up the server. However, there are so many problems we may come up when building the environment. One of them is cuda version compatibility. Hierarchy There are 3 layers of abstraction when using Nvidia gpu (cuda) to train the model. nvidia runtime (libcudart.so, cuda-toolkit, nvcc) nvidia drivernvidia user-mode driver (libcuda.so)
     Like  Bookmark
  • Problem Link Thinking Group words by first letter. Obviously, two words in the same group (i.e. same first letter) cannot form a valid pair. For convenience, let's store each word by their suffix.
     Like  Bookmark
  • Problem Suppose we want to know the ratio of supporters of some political party to the whole people, or how many supporters. It is often expensive to ask everyone and sum up the data. Instead, we randomly ask a few people, and take the ratio in the selected people as our answer. Intuitively, the more people we ask, the more accurate our result is close to the real answer. Problem Formulation Let $U$ be the universe and $G$ be the target group. Assume we are given $|U|$
     Like  Bookmark
  • Desciption You are given an array people where people[i] is the weight of the i-th person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most limit. Return the minimum number of boats to carry every given person. For example: people = [4, 5, 3, 1] limit = 8 ans = 2 ((5, 3) and (4, 1))
     Like  Bookmark
  • In modern computers, we have multi-core (multi-processor) to do parallel programming, however, synchronization between the threads is very hard to achieve. To deal with these sync issues, some solutions are provided. Basics Hardware Support 1. Atomic instruction Instruction that cannot be stopped while exectuting. test and set compare and swap fecch and add
     Like  Bookmark
  • Overview Link is creating another reference to a given file. There are 2 types of link within the file system hard link soft link (symbolic link, or symlink) Hard link Usage
     Like  Bookmark
  • 如標題所示,這篇打算講講這個寫法,如果詳細點,可以寫成 x = y; if (x == z) do_something(); 這邊非常建議,不要用這種寫法 在C裡,這個寫法雖然很簡潔,但是出bug時非常難找到他。譬如說我寫成 if ((x = y == z))
     Like  Bookmark
  • Idea MCST GCN 4 score design GCN A 1-step reaction prediction model. Used in expansion and rollout phase. In expansion phase, the branching factor is determined by the top-n accuracy
     Like  Bookmark
  • Problem Given a linked list, detect if some cycle exists. A naive solution is to use hash table to record while traversing the linked list, which requires $O(n)$ time and $O(n)$ space. In the following section, we will describe an algorithm that solves this problem in $O(1)$ space. Algorithm The algorithm is actually a two pointer algorithm. We maintain two pointer fast and slow while traversing the linked list.
     Like  Bookmark
  • Objective: Develop (multi-step) synthetic routes to a target molecule. Previous work 3N-MCTS Depth-First-Proof-Number-Search (DFPNS) RL-based approach Transformer Retro* (A* search)
     Like  Bookmark