Skip to main content

Posts

Showing posts from June, 2020

CardPole Reinforcement Learning

My own solution for the CardPole-Challange. I only use the pole-angle, nothing else. I remember a history of it (with memory capacity) With a memory capacity of 1 it does not work, with 2 I need luck. 3 and more look good. I already solved it with all 4 parameters but this did not match my personal experience where I am balancing a pole on my finger. The only thing I observe here is the angle. import gym import random import numpy as np class HillClimbingAgent(): def __init__(self, env): self .action_size = env.action_space.n self .state = [ 0 , 0 , 0 ] # memory capacity self .input_size = len( self .state) self .W = 1e-4 * np.random.rand( self .action_size, self .input_size) self .best_W = np.copy( self .W) self .best = -np.inf self .noise_scale = 1e-5 def _append_to_state(self, state): n = len( self .state) for i in range( 0 , n- 1 ): self .state[n-i- 1 ] = self .state[n-i- 2...

Small numbers are fearful

When developing a business small numbers create fear. In contrast zero imagines imagination. It takes courage to provoke the small numbers. So do it from day one as everything that becomes harder over time (like integrating or deploying software).

Ouptut current php.ini

When I cannot access the php.ini: <?php function to_ini ( $array ) { $res = array (); foreach ( $array as $key => $val ) { if ( is_array ( $val )) { $res [] = " \n [ $key ]" ; foreach ( $val as $skey => $sval ) $res [] = " $skey = " .( is_numeric ( $sval ) ? $sval : '"' . $sval . '"' ); } else $res [] = " $key = " .( is_numeric ( $val ) ? $val : '"' . $val . '"' ); } return implode ( " \r\n " , $res ); } function php_ini () { return to_ini ( ini_get_all ()); } echo '<pre>' ; print_r ( php_ini ()); die ();

Two questions to avoid waste

Two questions to avoid waste. It is important because I can implement nearly everything. But what should I implement? The questions are: If I would achieve my goal, can I sell it? (value, distribution, ...) Can I achieve my goal? I have to balance the answer to both.

Developing software is like walking

My mind is searching for the right location where to put my foot. Then I put it there (write production code) and then, without changing the points where I touch the ground, I 'refactor' my body, so that I am able to take the next step. I react to the environment plan the next steps and know where I want to go.

From regression of 5Ws to a Unit-Test

Whenever I detect a regression (automatic, manually, monitoring), I ask the five "Why?"s. This brings me to the root cause of the problem.  The root cause is almost always human and should normally be fixed on this level on the design level.  To improve the safety net, I take the last technical answer (of the 5) and write a focused unit test. After making it green the problem is gone. With it a whole class of problems as I fixed the (technical) root cause.

Three options of handling AGI

Lex Friedman gave Elon Musk (on AI podcast) three options to handle with Artificial General Intelligence:  Scanning up Efforts in AI Safety and Research in hope of finding an algorithmic or policy solution Becoming a multi-planetary species as quickly as possible Merging with AI and riding the wave of that increasing intelligence IMHO 3 All are promising and interesting. Order: 3,1,2 Problem with 1 is that regulatory agencies are very slow, science and engineering is fast

Functional Tests require empathy

Functional Tests require empathy. Not too easy to do while stuck with technical programming. Requires skill. Especially when I do it in an iterative style where I develop the functional tests along with the code; it requires not only context switches but worldview-switches.

Portable C++ App

C++ Apps are not portable because of the dynamic libs. This (rough) script creates a portable version together with a Dockerfile to evaluate it: import subprocess class Cmd (): def __init__ ( self ): self .cwd = '.' def cd ( self , to ): self .cwd = to def run ( self , command ): print (command) cammand_splitted = [x for x in command.split( ' ' ) if x] result = subprocess.run(cammand_splitted, stdout =subprocess.PIPE, cwd = self .cwd) return result.stdout.decode( 'utf-8' ) class Bundler (): def __init__ ( self , executable , out , blacklist =[]): self .executable = executable self .out = out self .app_out = out+ 'app/' self .blacklist = [] def run ( self ): executable = self .executable out = self .out app_out = self .app_out cmd = Cmd() lines = cmd.run( f 'ldd { executable } ' ).split( ' \n ...

Secret detected: The future is already here – it's just not evenly distributed

“The future is already here – it's just not evenly distributed. The Economist, December 4, 2003 ” ―  William Gibson This means I have to look at the right spots (papers, GitHub, etc) use some glue, software engineering, and domain knowledge and bundle a great company to distribute it. Distribution (of the future) is everything.

Being Different != Being Different

It is crucial to be different to be successful. But this does not mean refusing to shower. There are different types of being different. Choose the right one. Being different in the wrong way is counterproductive. I should just use my head. Don't be different because of the sake of difference. Think! Crowds are crazy. Detect this, make up my own mind. Then the difference is good.