1597001880
DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a data-clustering algorithm originally proposed by Ester et al in 1996.
Given a set of points P, the radius of a neighborhood ε, and a minimum number of points minPts:
Any given point may initially be considered noise and later revised to belong to a cluster, but once assigned to a cluster a point will never be assigned.
#algorithms #science #python #data-science #analytics
1624380180
Clustering based on basic standards like density, shape, and size is very common. In a similar way, DBSCAN is an extensive method of the density-based clustering algorithm.
For MapReduce check this article (https://medium.com/@rrfd/your-first-map-reduce-using-hadoop-with-python-and-osx-ca3b6f3dfe78)
Algorithm description:
#mapreduce #big-data #partitioning #dbscan #clustering-algorithm #big data clustering: mr-dbscan from scratch using python
1662003714
This tutorial shows how to create a scratch card with HTML, CSS and JavaScript. Basic knowledge of Canvas might come in handy for this project, but it isn’t necessary.
00:00 Intro
00:05 Project Preview
00:53 HTML & CSS
06:07 Step 1: Create Initial References
06:36 Step 2: Implement The init()
08:32 Step 3: Detect If The Device Is A Touch Device
12:16 Step 4: Get Position Of Mouse/Touch
14:40 Step 5: Add Event Listeners To Canvas
15:41 Step 6: Function To Draw Scratch
We start with the HTML code. The HTML code creates elements necessary to build the structure of our scratch card. First, copy the code below and paste it into your HTML document.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Scratch Card</title>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap"
rel="stylesheet"
/>
<!-- Stylesheet -->
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
<div class="base">
<h4>You Won</h4>
<h3>$10</h3>
</div>
<canvas id="scratch" width="200" height="200"></canvas>
</div>
<!-- Script -->
<script src="script.js"></script>
</body>
</html>
With CSS, we style the scratch card according to our desired theme. For this copy, the code provided to you below and paste it into your stylesheet.
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
height: 100vh;
background: linear-gradient(135deg, #c3a3f1, #6414e9);
}
.container {
width: 31em;
height: 31em;
background-color: #f5f5f5;
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
border-radius: 0.6em;
}
.base,
#scratch {
height: 200px;
width: 200px;
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
text-align: center;
cursor: grabbing;
border-radius: 0.3em;
}
.base {
background-color: #ffffff;
font-family: "Poppins", sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-shadow: 0 1.2em 2.5em rgba(16, 2, 96, 0.15);
}
.base h3 {
font-weight: 600;
font-size: 1.5em;
color: #17013b;
}
.base h4 {
font-weight: 400;
color: #746e7e;
}
#scratch {
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-user-select: none;
user-select: none;
}
Finally, we implement the logic of this code. To do that, copy the code below and paste it into your script file.
let canvas = document.getElementById("scratch");
let context = canvas.getContext("2d");
const init = () => {
let gradientColor = context.createLinearGradient(0, 0, 135, 135);
gradientColor.addColorStop(0, "#c3a3f1");
gradientColor.addColorStop(1, "#6414e9");
context.fillStyle = gradientColor;
context.fillRect(0, 0, 200, 200);
};
//initially mouse X and mouse Y positions are 0
let mouseX = 0;
let mouseY = 0;
let isDragged = false;
//Events for touch and mouse
let events = {
mouse: {
down: "mousedown",
move: "mousemove",
up: "mouseup",
},
touch: {
down: "touchstart",
move: "touchmove",
up: "touchend",
},
};
let deviceType = "";
//Detech touch device
const isTouchDevice = () => {
try {
//We try to create TouchEvent. It would fail for desktops and throw error.
document.createEvent("TouchEvent");
deviceType = "touch";
return true;
} catch (e) {
deviceType = "mouse";
return false;
}
};
//Get left and top of canvas
let rectLeft = canvas.getBoundingClientRect().left;
let rectTop = canvas.getBoundingClientRect().top;
//Exact x and y position of mouse/touch
const getXY = (e) => {
mouseX = (!isTouchDevice() ? e.pageX : e.touches[0].pageX) - rectLeft;
mouseY = (!isTouchDevice() ? e.pageY : e.touches[0].pageY) - rectTop;
};
isTouchDevice();
//Start Scratch
canvas.addEventListener(events[deviceType].down, (event) => {
isDragged = true;
//Get x and y position
getXY(event);
scratch(mouseX, mouseY);
});
//mousemove/touchmove
canvas.addEventListener(events[deviceType].move, (event) => {
if (!isTouchDevice()) {
event.preventDefault();
}
if (isDragged) {
getXY(event);
scratch(mouseX, mouseY);
}
});
//stop drawing
canvas.addEventListener(events[deviceType].up, () => {
isDragged = false;
});
//If mouse leaves the square
canvas.addEventListener("mouseleave", () => {
isDragged = false;
});
const scratch = (x, y) => {
//destination-out draws new shapes behind the existing canvas content
context.globalCompositeOperation = "destination-out";
context.beginPath();
//arc makes circle - x,y,radius,start angle,end angle
context.arc(x, y, 12, 0, 2 * Math.PI);
context.fill();
};
window.onload = init();
📁 Download Source Code :
https://www.codingartistweb.com
#html #css #js #javascript
1626657482
Part 1 - Creating Angular 9 website using Angular CLI - Angular Single page application
Download NodeJS
https://nodejs.org/en/download/
Install Angular CLI
https://cli.angular.io/
Create Angular project from scratch using Angular CLI
ng new ProjectName
Spin up the application in the browser
ng serve -o
#angular #bootstrap #angular 9 #scratch #scratch
1624633200
Each option has its benefits and drawbacks. The purpose of this article is to answer this question and clarify it! Also, it’s important to note that everyone has different needs. So there is not a universal answer.
What matters most
Before going further, let’s see the most important things one should look for when opening a blog. They are as follows:
#scratch #existing blogging platform #a blog from scratch
1592582580
What is DBSCAN
DBSCAN(Density-Based Spatial Clustering of Applications with Noise) is a commonly used unsupervised clustering algorithm proposed in 1996. Unlike the most well known K-mean, DBSCAN does not need to specify the number of clusters. It can automatically detect the number of clusters based on your input data and parameters. More importantly, DBSCAN can find arbitrary shape clusters that k-means are not able to find. For example, a cluster surrounded by a different cluster.
Also, DBSCAN can handle noise and outliers. All the outliers will be identified and marked without been classified into any cluster. Therefore, DBSCAN can also be used for Anomaly Detection (Outlier Detection)
Before we take a look at the preusdecode, we need to first understand some basic concepts and terms. Eps, Minpits, Directly density-reachable, density-reachable, density-connected, core point and border point
First of all, there are two parameters we need to set for DBSCAN, Eps, and MinPts.
#data-mining #outlier-detection #python #clustering #dbscan