• Implementation of Python to calculate the distance from point in plane to line


    Recently, I encountered a problem. I need to calculate the distance between the point in the plane and the straight line. I found that the mathematical knowledge was returned to the teacher. After Du Niang, I found the calculation method, which is hereby recorded. Calculation formula from point to line: Through the formula derivation, the […]

  • SVM support vector machine notes 1


    Support vector machine Many lines in this diagram can separate the two points. But which one?Intuitively, we will definitely choose the middle one, because it splits the two parts of data most “open” and has the highest fault tolerance rate. The most marginal point here actually plays a very important role. As long as the […]

  • Redis location


    The biggest feature added in redis 3.2 is the support for Geo (geographic location) In the current business, the map aspect is to call Gaode API (cloud image), and the request will be delayed. However, redsigeo can find the nearby terminal and measure the linear distance between two points (with error) 1. Geoadd: add the […]

  • An occasional question on leetcode


    Address: https://leetcode-cn.com/probl…repoAddress: https://github.com/pigpigever… Topic analysis The Hamming distance between two integers refers to the number of different binary positions corresponding to the two numbers. Give two integers x and y, and calculate the Hamming distance between them. For example, there are two binary values: 001 100 The Hamming distance between them is2What we need is […]

  • Square Euclidean distance and error square sum of spark kmeans and source code analysis


    1. Euclidean distanced(x,y) = √( (x[1]-y[1])^2 + (x[1]-y[2])^2 + … + (x[n]-y[n])^2 )2. Square Euclidean distanceThe distance formula of spark kmeans uses the square Euclidean distance. The square Euclidean distance is the square of the Euclidean distance (excluding the open root sign)d(x,y) = (x[1]-y[1])^2 + (x[1]-y[2])^2 + … + (x[n]-y[n])^2 3. Sum of squared error […]

  • Automatic driving hardware system lidar measurement model


    Lidar (light detection and ranging) is a widely used hardware sensor in Google’s autopilot technology. 1. Working principle of lidar By continuously emitting the laser beam, the laser beam will reflect when encountering obstacles, and part of the reflection will be received by lidar sensor again. By measuring the round trip time of laser beam […]

  • Implementation and comparison of two text similarity algorithms


    background Recently, a crawler related project needs to exclude some similar links, such as the previous page, the next page and other useless links in the paging control Edit distance algorithm Editing distance, also known as Levenshtein Distance (also known as edit distance), refers to the minimum number of editing operations required between two strings […]

  • Canvas drawing flow chart demo


    preface Why do you write this?The requirement is that a draggable flow chart drawing function is needed, as shown in the figure: Implementation mode Lines are drawn with canvas, and other elements are implemented with HTML. Key points Third order Bessel curve functionbezierCurveTo。 code analysis 1. Get the data: list = [ { id: 1, […]

  • Vue.js Implement the effect of forbidding H5 page from dropping down bounce built in IOS browser


    introduce vue-disbounceIt’s based onVue.jsCan effectively avoid triggeringh5Page iniosBrowser built-in drop-downbounceeffect. assembly <template> <div :style=”{‘background-color’:backgroundColor }” class=”vd-wrapper” > <div class=”vd” ref=”vd” > <slot></slot> </div> </div> </template> <script> export default { name: “vd”, props: { backgroundColor: { type: String, default: “#ffffff” } }, data() { return {}; }, mounted() { this.vd = this.$refs[“vd”]; this.vd.addEventListener(“touchstart”, this.touchstartEvent); this.vd.addEventListener(“touchmove”, this.touchmoveEvent, […]

  • The interviewer laughed when he said four ways to realize lbs “people nearby”


    introduction Yesterday, a buddies of the official account and I discussed an interview question. Personally, it was more meaningful. I arranged it here to share it with you. The interview question is relatively simple: “let you realize the function of a nearby person, what plan do you have?” In fact, this question is mainly to […]

  • Five minutes for super simple image Pseudo 3D effect


    preface Recently, I saw a cool but easy to achieve Pseudo 3D image effect. The effect is as follows: Now let’s see how to implement it. stores reserve The materials we need to prepare are: A picture. Depth map of the above picture. What is depth map? Depth map is a kind of image that […]

  • Square Euclidean distance and error sum of spark kmeans and source code analysis


    1. Euclidean distanced(x,y) = √( (x[1]-y[1])^2 + (x[1]-y[2])^2 + … + (x[n]-y[n])^2 )2. Squared Euclidean distanceThe distance formula of spark kmeans uses the square Euclidean distance. The square Euclidean distance is the square of the Euclidean distance (without the root sign)d(x,y) = (x[1]-y[1])^2 + (x[1]-y[2])^2 + … + (x[n]-y[n])^2 3. Sum of squared error (SSE)The […]