> 2021年04月14日信息消化 #### 40句名言成为更好的开发者 原文:[40 Best Quotes That Made Me A Developer](https://www.devglan.com/blog/best-developer-quotes) - 编程语言是用来思考程序的,不是用来表达你已经想好的程序的。它应该是一支铅笔,而不是一支笔。A programming language is for thinking about programs, not for expressing programs you've already thought of. It should be a pencil, not a pen. - Paul Graham - 不要评论糟糕的代码--重写它。Don't comment bad code - rewrite it. - Brian Kernighan - 在没有需求和设计的情况下,编程就是在一个空的文本文件中添加bug的艺术。Without requirements or design, programming is the art of adding bugs to an empty text file.Without requirements or design, programming is the art of adding bugs to an empty text file. - 人们并不关心你说什么,他们关心的是你建立什么。People don't care about what you say, they care about what you build. - Mark Zuckerberg - Talk is cheap. Show me the code. - Linus Torvalds - 一个好的软件的功能就是让复杂的东西显得简单。The function of a good software is to make the complex appear to be simple. - Grady Booch - 小心思关注非凡,大心思关注平凡。Small minds are concerned with the extraordinary, great minds with the ordinary. - Blaise Pascal - 一个好的程序员是在过单行道之前总是两边看的人。A good programmer is someone who always looks both ways before crossing a one-way street. - Doug Linder - 测试只能证明存在错误,而不能证明没有错误。Testing can only prove the presence of bugs, not their absence. – Edsger W. Dijkstra #### Paper | 学习是由神经参与的骤变形成 原文:[Learning is shaped by abrupt changes in neuralengagement](https://users.ece.cmu.edu/~byronyu/papers/HennigNN2021.pdf) 我们训练了三只恒河猴来调制初级运动皮层(M1)中约90个单位的活动,以使用BCI23在屏幕上移动计算机光标。在以前的工作中,我们比较了猴子学会使用新的BCI映射26,39之前与之后的神经群体活动。 > We trained three rhesus monkeys to modulate the activity of ~90 units in primary motor cortex (M1) to move a computer cursor on a screen using a BCI23. In previous work, we compared the neural population activity before versus after monkeys learned to use a new BCI mapping26,39. 在这里,我们研究了神经活动如何在整个学习过程中发生变化,以及这些变化受猴子内部状态波动的影响程度。我们首先确定了M1群体活动最大波动的维度。令人惊讶的是,沿着这些维度的人口活动的突然变化是由任务的各个方面的变化所触发的,从任务的短暂停顿到BCI映射的扰动。此外,沿这些维度的群体活动的试验到试验的变化与猴子瞳孔大小的变化相关。 > Here we study how neural activity changes throughout learning, and the degree to which these changes are influenced by fluctuations in the monkey’s internal state. We first identified the dimensions of the largest fluctuations in M1 population activity. Surprisingly, abrupt changes in population activity along these dimensions were triggered by changes in various aspects of the task, ranging from brief pauses in the task to perturbations of the BCI mapping. Furthermore, trial-to-trial changes in population activity along these dimensions were correlated with changes in the monkey’s pupil size.  #### News | 埃隆-马斯克可能会成立一家新公司,而且会比特斯拉和SpaceX更大 原文:[Elon Musk Might Start A New Company, And It Will Be Bigger Than Tesla And SpaceX](https://medium.com/the-innovation/elon-musk-might-start-a-new-company-and-it-will-bigger-than-tesla-and-spacex-f60eff87495c) - SpaceX = cheaper and fast rockets that will make humans interplanetary - Tesla = drive a cool vehicle while making an impact on the environment - OpenAI = prevent a skynet scenario from overtaking the humanity - Neuralink = brain interfaces that prevent neurological illnesses - Solar City = to make **solar** power accessible and affordable for everyone - The Boring Company = To solve the problem of soul-destroying traffic, roads - Hyperloop = to eliminate the barriers of distance and time in transportation - **X = Ensure human survival and progress**  #### Octave教程 [Machine Learning by Stanford University](https://www.coursera.org/learn/machine-learning/lecture/9fHfl/basic-operations) 基本使用 | Basic Operations ```octave % Change Prompt PS1('>> '); % ; simicolon: go next line % Work with variables a = pi; a >> a = 3.1415 format long a >> a = 3.14159265358979 disp(sprinft('2 decimals: %0.2f', a)) >> 2 decimals: 3.14 % Matrix A = [1 2; 3 4; 5 6] ones(2, 3) zeros(2, 3) rand(2, 3) randn(1, 3) % Gaussian distribution eye(4) % 4 by 4 identity matrix % Hist W = -6 + sqrt(10)*(randn(1, 10000)); hist(W) hist(W, 50) % load & clear & export data load featureX.dat clear featureX save output.mat featureX % binary save output.txt featureX -ascii % save as text (ASCII) % check variables in the current scope whos % Access matrix elements A = [1 2; 3 4; 5 6] A(3,2) A(2,:) % ":" means every element along that row/column A(:, 2) >> vector: 246 A(:,2) = [10; 11; 12] % replace 2nd row with 10 11 12 A = [A, [100;101;102]]; % append another column vector to right A(:) % put all elements of A into a single vector C = [A B] % concatenating A and B (left/right) C = [A; B] % put at bottom ``` ##### 计算数据 Computing on Data ```octave % element-wise multiplication of 2 matrices A .* B % take each element of A and multiply it by the corresponding elements B % element square A .^ 2 % element wise inverse 1 ./ A log(v) exp(v) % exponentiation abs(v) % absolute -v % -1*v v' % transpose a = [1 15 2 0.5] val = max(a) % find the max [val, ind] = max(a) % find the max and its index a < 3 % element wise comparison, return true/false (1/0) find(a < 3) % return index % Create an N-by-N magic square. A = magic(3) [r, c] = find(A >= 7,) % r,c stands for row and column (index) a = rand(3) sum(a) % sum column floor(a) ceil(a) % get max with column max(A, [], 1) % get max with row max(A, [], 2) % get max element max(A(:)) % or max(max(A)) sum(A, 1) % sum per column sum(A, 2) % sum per row A .* eye(9) sum(sum(A.*eye(9))) % sum up the opposite diagonal from bottom left to top right. flipup(eye(9)) % flip verifcally pinv(A) % inverse of A ``` ##### 描绘数据 Plotting Data ```octave t= [0:0.01:0.98]; y1 = sin(2*pi*4*t); plot(t, y1) % play 2 figures hold on y2 = cos(2*pi*4*t) plot(t, y2, 'r') % red xlabel('time') ylabel('value') legend('sin','cos' title('my plot') % export image cd ~/Desktop; print -dpng 'myPlot.png' % plot multiple window figure(1); plot(t, y1); figure(2); plot(t, y2); % subplot subplot(1,2,1); % Devide plot a 1x2 grid, plot 1 plot(t, y1); subplot(1,2,2); plot(t, y2); % Change axis scales axis([0.5 1 -1 1]) % set x range and y range clf; % clear figure % color A = magic(5) imagesc(A) % comma chaining function imagesc(A), colorbar, colormap gray; imagesc(magic(15)) , colorbar, colormap gray; ```  ##### 控制流 Control Statements: for, while, if statement ```octave % for loop v = 1:10 for i=1:10, v(i) = 2^i; end % while loop i = 1; while i <= 5, v(i) = 100; i = i + 1; end; while true, v(i) == 999; i = i+1; if i == 6, break; end; end; % if if x == 1, disp('The value is one'); elseif x == 2, disp('The value is two'); else end; % Function % file: /path/squareThisNumber.m function y = squareThisNumber(x) y = x^2; squareThisNumber(15) % Octave search path addpath('/path/') squareThisNumber(15) % return multiple values function [y1,y2] = squareAndCubeThisNumber(x) y1 = x^2; y2 = x^3; ``` ##### Cost Function ```octave function J = costFunctionJ(X, y, theta) m = size(X, 1); predictions = X*theta; sqrErrors = (predictions - y) .^2; J = 1/(2*m) * sum(sqrErrors); ```  ```octave X = [1 1; 1 2; 1 3] u = [1; 2; 3] theta = [0;1]; j = constFunctionJ(X,y,theta) theta = [0;0]; j = constFunctionJ(X,y,theta) ``` ### 一点收获 - 工欲善其事、必先利其器。 - 工、その事をよくせんと欲せば、必ずその器を利とす。