Mastering the Art of Car Dealership Negotiations

Navigating the realm of negotiation, especially with car dealers, feels like threading a needle in the dark. Dealers hold most of the cards, thanks to the imbalance of information. They decide what to reveal, while we, as buyers, have to piece together a strategy from fragments. But fret not! With patience, strategy, and a keen eye for details, you can level the playing field. 🚫 Rule #1: Resist the Urge to Commit Ever been offered a tempting discount right off the bat? Sounds irresistible, right? But here’s the catch: they often want an immediate commitment. Reflecting on my college days, I remember succumbing to such tactics. The lesson? If the offer comes too easily, it’s worth second-guessing. Push too hard, and I’d suggest gracefully exiting the conversation. You might just find them softening their stance, luring you back with even more enticing offers. Keep cool, and roll out strategy two: crunch those numbers. ...

September 16, 2023 · 3 min · 458 words · Me

Neural Network in Numpy

This is to implement backpropagation algorithm in numpy which would help me to further understand how this works. import pandas as pd import numpy as np from pdb import set_trace from sklearn import datasets Design the network structure Each layer contains the weights/bias and activation union structures = [ {"input_dim": 2, "output_dim": 25, "activation": "relu"}, {"input_dim": 25, "output_dim": 50, "activation": "relu"}, {"input_dim": 50, "output_dim": 50, "activation": "relu"}, {"input_dim": 50, "output_dim": 25, "activation": "relu"}, {"input_dim": 25, "output_dim": 1, "activation": "sigmoid"}, ] Initiate the parameters The weights can be random number and bias are preferred to be small postive values in order to pass the relu in the beginning. def init_layers(structures, seed = 1105): params = {} for i, structure in enumerate(structures): params["W_{}".format(i)] = np.random.randn(structure["input_dim"], structure["output_dim"])/10 params["b_{}".format(i)] = np.random.randint(1,10, (1, structure["output_dim"]))/100 return params The forward and backword activation union During back propagation, it is appraent we would need use the output value before activation in feed forward process. We would need to save the ouput before and after activation in each layer for back propagation later. def relu(U): U[U < 0] = 0 return U def sigmoid(U): return np.divide(1, (1+np.exp(-1*U))) def relu_backward(du, U): du[U < 0] = 0 return du def sigmoid_backward(du, U): sig = sigmoid(U) * (1 - sigmoid(U)) return du*sig So, we return two values in single_layer_feedforward function corresponding to the activated output and output which doesn’t. The activated output will be feed as input into the next layer and the unactivated output will be used in backpropagation - the reason is we need the partial derivatives of activation union to its input. ...

September 16, 2023 · 4 min · 829 words · Me

Sneak peek at the asynchronous Java

Java 19 is here with the preview of loom project. Loom project is the one helps Java become asynchronous and come back to the table to compete with other asynchronous language such as Golang. But why do we need Java to be asynchronous? Blocking It is all because we don’t want to be blocked. And the best example must be how you do your driver license renewal at the DMV. I remember I work up at 5:30 in the morning and drove to the DMV where there was already a line of 50 people. But I have no choice but to join them. After several hours’ waiting, I can finally check in and get a number for my case. Then I was eligible to walk in and find a chair to continue my waiting. After another couple hours, I finally got called at a window and finished my license renewal task. ...

September 16, 2023 · 3 min · 623 words · Me

The elegant consensus algorithm - Multi-Paxos - in Java gRPC

Introduction Paxos is a distributed consensus algorithm developed by Lamport. It is proved optimal and many systems are built based on it like chubby and zookeeper. But this article is not going to discuss Lamport’s orginal paper but focus on the engineering implementations. My colleague highly recommended Ongaro’s lecture of Paxos and said it is the best source of learning Paxos. I cannot agree more after studying it. That being said, I will briefly talk about Paxos and Multi-Paxos and dive into the engineering implementations. ...

September 16, 2023 · 6 min · 1122 words · Me

Why I don't like WSL

If you are not using Java or Intellij Idea for your project, you could stop reading. Couple months ago, I am very excited with WSL2 and it works perfectly for me to work on some Java projects in Intellij Idea. Somehow everything is upside down and obviously after some updates of windows though I still stick with win10. Long story short! Intellij Idea is really slow with WSL regarding the version. The indexing takes forever and it is not new as I found in this thread and this thread and the problem could be one of the following: ...

September 16, 2023 · 2 min · 281 words · Me

0 min · 0 words · Me

0 min · 0 words · Me

0 min · 0 words · Me