Coder Social home page Coder Social logo

blog's Introduction

Hi there 👋 I'm Stephen 👨🏻‍💻

  • 👨🏻‍💻 Machine Learning Engineer of AGI
  • 📚 Educator in Large Language Models (LLMs)
  • 🔭 Seeking collaboration in LLM applications
  • 🤝 In need of assistance with multi-agent frameworks
  • 🤔 Expertise in NLP and LLMs, open for queries
  • 💬 Contact: [email protected]
  • ⚡ Enjoy 🏂 🤿 🏍

Places to find me 🌐

blog's People

Contributors

stephengineer avatar

Watchers

 avatar

blog's Issues

Javascript Keywords

Javascript Keywords

let VS var

Difference between let and var.

Description

let gives you the privilege to declare variables that are limited in scope to the block, statement of expression, unlike var.

var is rather a keyword that defines a variable globally regardless of block scope.

Global window object

Even if the let variable is defined as the same as the var variable globally, the let variable will not be added to the global window object.

var varVariable = “this is a var variable”;
let letVariable = “this is a let variable”;

console.log(window.varVariable); //this is a var variable
console.log(window.letVariable); //undefined

Thus let variables cannot be accessed in the window object because they cannot be globally accessed.

Block

let variables are usually used when there is limited use of those variables. Say, in for loops, while loops or inside the scope of if conditions, etc. Basically, where ever the scope of the variable has to be limited.

For loop using let variable:

for(let i=0;i<10;i++){
	console.log(i); //i is visible thus is logged in the console as 0,1,2,....,9
}
console.log(i); //throws an error as "i is not defined" because i is not visible

For loop using var variable:

for(var i=0; i<10; i++){
	console.log(i); //i is visible thus is logged in the console as 0,1,2,....,9
}
console.log(i); //i is visible here too. thus is logged as 10.

Redeclaration

let variables cannot be re-declared while var variable can be re-declared in the same scope.

Assume we are using strict mode:

'use strict';
var temp = "this is a temp variable";
var temp = "this is a second temp variable"; //replaced easily

We cannot do the same thing with let:

'use strict';
let temp = "this is a temp variable";
let temp = "this is a second temp variable" //SyntaxError: temp is already declared

Function

let and var variables work the same way when used in a function block.

function aSampleFunction(){
	let letVariable = "Hey! What's up? I am let variable.";
	var varVariable = "Hey! How are you? I am var variable.";
	console.log(letVariable); //Hey! What's up? I am let variable.
	console.log(varVariable); //Hey! How are you? I am var variable.
}

Thank Krish S Bhanushali for providing the reference.

Machine Learning

Introduction

Types of machine learning problems

  1. On basis of the nature of the learning “signal” or “feedback” available to a learning system

    • Supervised learning: The computer is presented with example inputs and their desired outputs, given by a “teacher”, and the goal is to learn a general rule that maps inputs to outputs. The training process continues until the model achieves the desired level of accuracy on the training data. Some real-life examples are:

      • Image Classification: You train with images/labels. Then in the future, you give a new image expecting that the computer will recognize the new object.
      • Market Prediction/Regression: You train the computer with historical market data and ask the computer to predict the new price in the future.
    • Unsupervised learning: No labels are given to the learning algorithm, leaving it on its own to find structure in its input. It is used for the clustering population in different groups. Unsupervised learning can be a goal in itself (discovering hidden patterns in data).

      • Clustering: You ask the computer to separate similar data into clusters, this is essential in research and science.
      • High Dimension Visualization: Use the computer to help us visualize high dimension data.
      • Generative Models: After a model captures the probability distribution of your input data, it will be able to generate more data. This can be very useful to make your classifier more robust.
    • Semi-supervised learning: Problems where you have a large amount of input data and only some of the data is labeled, are called semi-supervised learning problems. These problems sit in between both supervised and unsupervised learning. For example, a photo archive where only some of the images are labeled, (e.g. dog, cat, person) and the majority are unlabeled.

    • Reinforcement learning: A computer program interacts with a dynamic environment in which it must perform a certain goal (such as driving a vehicle or playing a game against an opponent). The program is provided feedback in terms of rewards and punishments as it navigates its problem space.

  2. On the basis of “output” desired from a machine-learned system

    • Classification: Inputs are divided into two or more classes, outputs are discrete rather than continuous, and the learner must produce a model that assigns unseen inputs to one or more (multi-label classification) of these classes. This is typically tackled in a supervised way. Spam filtering is an example of classification, where the inputs are email (or other) messages and the classes are “spam” and “not spam”.
    • Regression: It is also a supervised learning problem, but the outputs are continuous rather than discrete. For example, predicting stock prices using historical data.
    • Clustering: Here, a set of inputs is to be divided into groups. Unlike in classification, the groups are not known beforehand, making this typically an unsupervised task.
    • Density estimation: The task is to find the distribution of inputs in some space.
    • Dimensionality reduction: It simplifies inputs by mapping them into a lower-dimensional space. Topic modeling is a related problem, where a program is given a list of human language documents and is tasked to find out which documents cover similar topics.

Some commonly used machine learning algorithms are Linear Regression, Logistic Regression, Decision Tree, SVM(Support vector machines), Naive Bayes, KNN(K nearest neighbors), K-Means, Random Forest, etc.

https://www.geeksforgeeks.org/getting-started-machine-learning/

Supervised learning

Types of Classifiers (algorithms)

  • Linear Classifiers: Logistic Regression
  • Tree-Based Classifiers: Decision Tree Classifier
  • Support Vector Machines
  • Artificial Neural Networks
  • Bayesian Regression
  • Gaussian Naive Bayes Classifiers
  • Stochastic Gradient Descent (SGD) Classifier
  • Ensemble Methods: Random Forests, AdaBoost, Bagging Classifier, Voting Classifier, ExtraTrees Classifier

Types of Regression

  • Linear regression
  • Logistic regression
  • Polynomial regression
  • Stepwise regression
  • Stepwise regression
  • Ridge regression
  • Lasso regression
  • ElasticNet regression

Gradient Descent

Gradient Descent is an optimization algorithm used for minimizing the cost function in various machine learning algorithms. It is basically used for updating the parameters of the learning model.

Types of gradient Descent:

  • Batch Gradient Descent: This is a type of gradient descent which processes all the training examples for each iteration of gradient descent. But if the number of training examples is large, then batch gradient descent is computationally very expensive. Hence if the number of training examples is large, then batch gradient descent is not preferred. Instead, we prefer to use stochastic gradient descent or mini-batch gradient descent.
  • Stochastic Gradient Descent: This is a type of gradient descent that processes 1 training example per iteration. Hence, the parameters are being updated even after one iteration in which only a single example has been processed. Hence this is quite faster than batch gradient descent. But again, when the number of training examples is large, even then it processes only one example which can be additional overhead for the system as the number of iterations will be quite large.
  • Mini Batch gradient descent: This is a type of gradient descent which works faster than both batch gradient descent and stochastic gradient descent. Here b examples where b<m are processed per iteration. So even if the number of training examples is large, it is processed in batches of b training examples in one go. Thus, it works for larger training examples and that too with a lesser number of iterations.

Linear Regression

Linear regression is a statistical approach for modeling the relationship between a dependent variable with a given set of independent variables.
We refer to dependent variables as response and independent variables as features for simplicity.

Simple Linear Regression

Simple linear regression is an approach for predicting a response using a single feature.

Multiple linear regression

Multiple linear regression attempts to model the relationship between two or more features and a response by fitting a linear equation to observed data. Clearly, it is nothing but an extension of Simple linear regression. Consider a dataset with p features(or independent variables) and one response(or dependent variable). Also, the dataset contains n rows/observations.

X (feature matrix) = a matrix of size n X p where x_{ij} denotes the values of jth feature for ith observation.
y (response vector) = a vector of size n where y_{i} denotes the value of response for ith observation.

Polynomial Regression

Advantages of using Polynomial Regression:

  • Broad range of function can be fit under it.
  • Polynomial basically fits a wide range of curvature.
  • Polynomial provides the best approximation of the relationship between the dependent and independent variables.

Disadvantages of using Polynomial Regression

  • These are too sensitive to the outliers.
  • The presence of one or two outliers in the data can seriously affect the results of nonlinear analysis.
  • In addition there are unfortunately fewer model validation tools for the detection of outliers in nonlinear regression than there are for linear regression.

https://www.geeksforgeeks.org/python-implementation-of-polynomial-regression/

Logistic Regression

In a classification problem, the target variable(or output), y, can take only discrete values for a given set of features(or inputs), X.
Contrary to popular belief, logistic regression IS a regression model. The model builds a regression model to predict the probability that a given data entry belongs to the category numbered as “1”. Just like Linear regression assumes that the data follows a linear function, Logistic regression models the data using the sigmoid function or *logistic function.

We can infer from the above graph that:

  • g(z) tends towards 1 as z -> +infty
  • g(z) tends towards 0 as z -> -infty
  • g(z) is always bounded between 0 and 1

Logistic regression becomes a classification technique only when a decision threshold is brought into the picture. The setting of the threshold value is a very important aspect of Logistic regression and is dependent on the classification problem itself.

The decision for the value of the threshold value is majorly affected by the values of precision and recall. Ideally, we want both precision and recall to be 1, but this seldom is the case. In case of a Precision-Recall tradeoff we use the following arguments to decide upon the threshold:

  1. Low Precision/High Recall: In applications where we want to reduce the number of false negatives without necessarily reducing the number of false positives, we choose a decision value that has a low value of Precision or a high value of Recall. For example, in a cancer diagnosis application, we do not want any affected patient to be classified as not affected without giving much heed to if the patient is being wrongfully diagnosed with cancer. This is because the absence of cancer can be detected by further medical diseases but the presence of the disease cannot be detected in an already rejected candidate.

  2. High Precision/Low Recall: In applications where we want to reduce the number of false positives without necessarily reducing the number of false negatives, we choose a decision value that has a high value of Precision or a low value of Recall. For example, if we are classifying customers whether they will react positively or negatively to a personalized advertisement, we want to be absolutely sure that the customer will react positively to the advertisement because otherwise, a negative reaction can cause a loss of potential sales from the customer.

Based on the number of categories, Logistic regression can be classified as:
1. binomial: target variable can have only 2 possible types: “0” or “1” which may represent “win” vs “loss”, “pass” vs “fail”, “dead” vs “alive”, etc.
2. multinomial: target variable can have 3 or more possible types that are not ordered(i.e. types have no quantitative significance) like “disease A” vs “disease B” vs “disease C”.
3. ordinal: it deals with target variables with ordered categories. For example, a test score can be categorized as: “very poor”, “poor”, “good”, “very good”. Here, each category can be given a score like 0, 1, 2, 3.

Confusion Matrix

A much better way to evaluate the performance of a classifier is to look at the confusion matrix. The general idea is to count the number of times instances of class A are classified as class B. Each row in a confusion matrix represents an actual class, while each column represents a predicted class. We want to predict some data using Classification in Machine Learning. Let the classifier be SVM, Decision Tree, Random Forest, Logistic Regression, and so on.

False Positive (type I error)

When we predict that something happens/occurs and it didn't happen/occurred.(rejection of a true null hypothesis) Example: We predict that an earthquake would occur which didn't happen.

False Negative (type II error)

When we predict that something won't happen/occur but it happens/occurs.(non-rejection of a false null hypothesis) Example: We predict that there might be no earthquake but there occurs an earthquake.

Usually, type I errors are considered to be not as critical as type II errors. But in fields like Medicine, Agriculture, both the errors might seem critical.

A 2x2 matrix denoting the right and wrong predictions might help us analyze the rate of success. This matrix is termed the Confusion Matrix.

Representation

0 1
0 TN FP
1 FN TP

The horizontal axis corresponds to the predicted values(y-predicted) and the vertical axis corresponds to the actual values(y-actual).

  • [1][1] represents the values that are predicted to be false and are actually false.
  • [1][2] represents the values that are predicted to be true but are false.
  • [2][1] represents the values that are predicted to be false but are true.
  • [2][2] represents the values that are predicted to be true and are actually true.

Using Confusion Matrix in code

Confusion Matrix can be used in python by importing the metrics module from sklearn.

from sklearn import metrics
cm = metrics.confusion_matrix(y_train, y_train_pred)
  • Rate of success
    r = (TN+TP)/(FN+FP)
from sklearn.metrics import accuracy_score
accuracy_score(y_train, y_train_pred)
  • Precision
    precision = (TP) / (TP+FP)
    TP is the number of true positives, and FP is the number of false positives.
    A trivial way to have perfect precision is to make one single positive prediction and ensure it is correct (precision = 1/1 = 100%). This would not be very useful since the classifier would ignore all but one positive instance.
from sklearn.metrics import precision_score
precision_score(y_train, y_train_pred)
  • Recall
    recall = (TP) / (TP+FN)
from sklearn.metrics import recall_score
recall_score(y_train, y_train_pred)

It is often convenient to combine precision and recall into a single metric called the F1 score, in particular, if you need a simple way to compare two classifiers. The F1 score is the harmonic mean of precision and recall.

# To compute the F1 score, simply call the f1_score() function:
from sklearn.metrics import f1_score
f1_score(y_train, y_train_pred)

The F1 score favors classifiers that have similar precision and recall. This is not always what you want: in some contexts, you mostly care about precision, and in other contexts, you really care about recall. For example, if you trained a classifier to detect videos that are safe for kids, you would probably prefer a classifier that rejects many good videos (low recall) but keeps only safe ones (high precision), rather than a classifier that has a much higher recall but lets a few terrible videos show up in your product (in such cases, you may even want to add a human pipeline to check the classifier’s video selection). On the other hand, suppose you train a classifier to detect shoplifters on surveillance images: it is probably fine if your classifier has only 30% precision as long as it has 99% recall (sure, the security guards will get a few false alerts, but almost all shoplifters will get caught). Unfortunately, you can’t have it both ways: increasing precision reduces recall and vice versa. This is called the precision/recall tradeoff.

https://www.geeksforgeeks.org/confusion-matrix-machine-learning/
https://github.com/Nitin1901/Confusion-Matrix

Binomial Logistic Regression

The likelihood is nothing but the probability of data(training examples), given a model and specific parameter values(here, regression coefficients). It measures the support provided by the data for each possible value of the regression coefficients. And for easier calculations, we take log(likelihood).

The cost function for logistic regression is proportional to the inverse of the likelihood of parameters so that the cost function is minimized using a gradient descent algorithm. where alpha is called learning rate and needs to be set explicitly.

Note: Gradient descent is one of the many ways to estimate regression coefficients.
Basically, these are more advanced algorithms that can be easily run in Python once you have defined your cost function and your gradients. These algorithms are:

  • BFGS(Broyden–Fletcher–Goldfarb–Shanno algorithm)
  • L-BFGS(Like BFGS but uses limited memory)
  • Conjugate Gradient

Advantages/disadvantages of using any one of these algorithms over Gradient descent:

  • Advantages
    • Don’t need to pick learning rate
    • Often run faster (not always the case)
    • Can numerically approximate gradient for you (doesn’t always work out well)
  • Disadvantages
    • More complex
    • More of a black box unless you learn the specifics

Multinomial Logistic Regression

In Multinomial Logistic Regression, the output variable can have more than two possible discrete outputs. Consider the Digit Dataset. Here, the output variable is the digit value which can take values out of (0, 12, 3, 4, 5, 6, 7, 8, 9).

At last, here are some points about Logistic regression to ponder upon:

  • Does NOT assume a linear relationship between the dependent variable and the independent variables, but it does assume a linear relationship between the logit of the explanatory variables and the response.
  • Independent variables can be even the power terms or some other nonlinear transformations of the original independent variables.
  • The dependent variable does NOT need to be normally distributed, but it typically assumes a distribution from an exponential family (e.g. binomial, Poisson, multinomial, normal,…); binary logistic regression assumes the binomial distribution of the response.
  • The homogeneity of variance does NOT need to be satisfied.
  • Errors need to be independent but NOT normally distributed.
  • It uses maximum likelihood estimation (MLE) rather than ordinary least squares (OLS) to estimate the parameters and thus relies on large-sample approximations.

Naive Bayes Classifiers

The fundamental Naive Bayes assumption is that each feature makes an:

  • independent
  • equal
    contribution to the outcome.

With relation to our dataset, this concept can be understood as:

  • We assume that no pair of features are dependent. For example, the temperature being ‘Hot’ has nothing to do with the humidity or the outlook being ‘Rainy’ has no effect on the winds. Hence, the features are assumed to be independent.
  • Secondly, each feature is given the same weight(or importance). For example, knowing the only temperature and humidity alone can’t predict the outcome accurately. None of the attributes is irrelevant and assumed to be contributing equally to the outcome.

Note: The assumptions made by Naive Bayes are not generally correct in real-world situations. In fact, the independence assumption is never correct but often works well in practice.

Other popular Naive Bayes classifiers are:

  • Multinomial Naive Bayes: Feature vectors represent the frequencies with which certain events have been generated by a multinomial distribution. This is the event model typically used for document classification.
  • Bernoulli Naive Bayes: In the multivariate Bernoulli event model, features are independent booleans (binary variables) describing inputs. Like the multinomial model, this model is popular for document classification tasks, where binary term occurrence(i.e. a word occurs in a document or not) features are used rather than term frequencies(i.e. frequency of a word in the document).

As we reach the end of this article, here are some important points to ponder upon:

  • In spite of their apparently over-simplified assumptions, naive Bayes classifiers have worked quite well in many real-world situations, famously document classification and spam filtering. They require a small amount of training data to estimate the necessary parameters.
  • Naive Bayes learners and classifiers can be extremely fast compared to more sophisticated methods. The decoupling of the class conditional feature distributions means that each distribution can be independently estimated as a one-dimensional distribution. This in turn helps to alleviate problems stemming from the curse of dimensionality.

https://www.geeksforgeeks.org/naive-bayes-classifiers/

Support Vector Machines(SVMs)

An SVM model is a representation of the examples as points in space, mapped so that the examples of the separate categories are divided by a clear gap that is as wide as possible.
In addition to performing linear classification, SVMs can efficiently perform a non-linear classification, implicitly mapping their inputs into high-dimensional feature spaces.

Decision Tree

  • Decision tree algorithm falls under the category of supervised learning. They can be used to solve both regression and classification problems.
  • Decision tree uses the tree representation to solve the problem in which each leaf node corresponds to a class label and attributes are represented on the internal node of the tree.
  • We can represent any Boolean function on discrete attributes using the decision tree.

Below are some assumptions that we made while using the decision tree:

  • In the beginning, we consider the whole training set as the root.
  • Feature values are preferred to be categorical. If the values are continuous then they are discretized prior to building the model.
  • On the basis of attribute values records are distributed recursively.
  • We use statistical methods for ordering attributes as root or the internal node.
  1. Information Gain
    When we use a node in a decision tree to partition the training instances into smaller subsets the entropy changes. Information gain is a measure of this change in entropy.

Entropy

Entropy is the measure of uncertainty of a random variable, it characterizes the impurity of an arbitrary collection of examples. The higher the entropy more the information content.

Building Decision Tree using Information Gain

The essentials:

  • Start with all training instances associated with the root node
  • Use info gain to choose which attribute to label each node with
  • Note: No root-to-leaf path should contain the same discrete attribute twice
  • Recursively construct each subtree on the subset of training instances that would be classified down that path in the tree.

The border cases:

  • If all positive or all negative training instances remain, a label that node “yes” or “no” accordingly
  • If no attributes remain, label with a majority vote of training instances left at that node
  • If no instances remain, label with a majority vote of the parent’s training instances
  1. Gini Index
  • Gini Index is a metric to measure how often a randomly chosen element would be incorrectly identified.
  • It means an attribute with a lower Gini index should be preferred.
  • Sklearn supports the “Gini” criteria for Gini Index and by default, it takes “gini” value.
  • The Formula for the calculation of the Gini Index is given below.

The most notable types of decision tree algorithms are:-

  • Iterative Dichotomiser 3 (ID3): This algorithm uses Information Gain to decide which attribute is to be used to classify the current subset of the data. For each level of the tree, information gain is calculated for the remaining data recursively.
  • C4.5: This algorithm is the successor of the ID3 algorithm. This algorithm uses either Information gain or Gain ratio to decide upon the classifying attribute. It is a direct improvement from the ID3 algorithm as it can handle both continuous and missing attribute values.
  • Classification and Regression Tree(CART): It is a dynamic learning algorithm which can produce a regression tree as well as a classification tree depending upon the dependent variable.

Strengths and Weakness of the Decision Tree approach

The strengths of decision tree methods are:

  • Decision trees are able to generate understandable rules.
  • Decision trees perform classification without requiring much computation.
  • Decision trees are able to handle both continuous and categorical variables.
  • Decision trees provide a clear indication of which fields are most important for prediction or classification.

The weaknesses of decision tree methods :

  • Decision trees are less appropriate for estimation tasks where the goal is to predict the value of a continuous attribute.
  • Decision trees are prone to errors in classification problems with many classes and a relatively small numbers of training examples.
  • Decision trees can be computationally expensive to train. The process of growing a decision tree is computationally expensive. At each node, each candidate splitting field must be sorted before its best split can be found. In some algorithms, combinations of fields are used and a search must be made for optimal combining weights. Pruning algorithms can also be expensive since many candidate sub-trees must be formed and compared.

https://www.geeksforgeeks.org/decision-tree-introduction-example/
https://www.geeksforgeeks.org/decision-tree/

Random Forest Regression

A Random Forest is an ensemble technique capable of performing both regression and classification tasks with the use of multiple decision trees and a technique called Bootstrap and Aggregation, commonly known as bagging. The basic idea behind this is to combine multiple decision trees in determining the final output rather than relying on individual decision trees.
Random Forest has multiple decision trees as base learning models. We randomly perform row sampling and feature sampling from the dataset forming sample datasets for every model. This part is called Bootstrap.

We need to approach the Random Forest regression technique like any other machine learning technique

  • Design a specific question or data and get the source to determine the required data.
  • Make sure the data is in an accessible format else convert it to the required format.
  • Specify all noticeable anomalies and missing data points that may be required to achieve the required data.
  • Create a machine learning model
  • Set the baseline model that you want to achieve
  • Train the data machine learning model.
  • Provide an insight into the model with test data
  • Now compare the performance metrics of both the test data and the predicted data from the model.
  • If it doesn’t satisfy your expectations, you can try improving your model accordingly or dating your data or use another data modeling technique.
  • At this stage you interpret the data you have gained and report accordingly.

Ensemble Classifier

Ensemble learning helps improve machine learning results by combining several models. This approach allows the production of better predictive performance compared to a single model. Basic idea is to learn a set of classifiers (experts) and to allow them to vote.

  • Statistical Problem
    The Statistical Problem arises when the hypothesis space is too large for the amount of available data. Hence, there are many hypotheses with the same accuracy on the data and the learning algorithm chooses only one of them! There is a risk that the accuracy of the chosen hypothesis is low on unseen data!
  • Statistical Problem
    The Computational Problem arises when the learning algorithm cannot guarantees finding the best hypothesis.
  • Representational Problem
    The Representational Problem arises when the hypothesis space does not contain any good approximation of the target class(es).

Main Challenge for Developing Ensemble Models?

The main challenge is not to obtain highly accurate base models, but rather to obtain base models which make different kinds of errors. For example, if ensembles are used for classification, high accuracies can be accomplished if different base models misclassify different training examples, even if the base classifier accuracy is low.

Methods for Independently Constructing Ensembles

  • Majority Vote
  • Bagging and Random Forest
  • Randomness Injection
  • Feature-Selection Ensembles
  • Error-Correcting Output Coding

Methods for Coordinated Construction of Ensembles

  • Boosting
  • Stacking

Reliable Classification: Meta-Classifier Approach
Co-Training and Self-Training

Types of Ensemble Classifier

Bagging

Bagging (Bootstrap Aggregation) is used to reduce the variance of a decision tree. Suppose a set D of d tuples, at each iteration i, a training set Di of d tuples is sampled with replacement from D (i.e., bootstrap). Then a classifier model Mi is learned for each training set D < i. Each classifier Mi returns its class prediction. The bagged classifier M* counts the votes and assigns the class with the most votes to X (unknown sample).

Implementation steps of Bagging
  1. Multiple subsets are created from the original data set with equal tuples, selecting observations with replacement.
  2. A base model is created on each of these subsets.
  3. Each model is learned in parallel from each training set and independent of each other.
  4. The final predictions are determined by combining the predictions from all the models.

Random Forest

Random Forest is an extension over bagging. Each classifier in the ensemble is a decision tree classifier and is generated using a random selection of attributes at each node to determine the split. During classification, each tree votes, and the most popular class is returned.

Implementation steps of Random Forest
  1. Multiple subsets are created from the original data set, selecting observations with replacement.
  2. A subset of features is selected randomly and whichever feature gives the best split is used to split the node iteratively.
  3. The tree is grown to the largest.
  4. Repeat the above steps and prediction is given based on the aggregation of predictions from n number of trees.

Voting Classifier

A Voting Classifier is a machine learning model that trains on an ensemble of numerous models and predicts an output (class) based on their highest probability of chosen class as the output.
It simply aggregates the findings of each classifier passed into Voting Classifier and predicts the output class based on the highest majority of voting. The idea is instead of creating separate dedicated models and finding the accuracy for each of them, we create a single model that trains by these models and predicts output based on their combined majority of voting for each output class.

Voting Classifier supports two types of votings.

  1. Hard Voting: In hard voting, the predicted output class is a class with the highest majority of votes i.e the class which had the highest probability of being predicted by each of the classifiers. Suppose three classifiers predicted the output class(A, A, B), so here the majority predicted A as output. Hence A will be the final prediction.
  2. Soft Voting: In soft voting, the output class is the prediction based on the average of probability given to that class. Suppose given some input to three models, the prediction probability for class A = (0.30, 0.47, 0.53) and B = (0.20, 0.32, 0.40). So the average for class A is 0.4333 and B is 0.3067, the winner is clearly class A because it had the highest probability averaged by each classifier.

Unsupervised learning

Download and install Maven on Windows

To install Apache Maven on Windows, you just need to download the Maven’s zip file and Unzip it to the directory you wish to install and configure the Windows environment variables.

Tools Used

  • JDK 1.7
  • Maven 3.2.2
  • Windows OS

Note

Maven 3.2 requires JDK 1.6 or above, while Maven 3.0/3.1 requires JDK 1.5 or above

1. JDK and JAVA_HOME

Make sure JDK is installed, and the "JAVA_HOME" variable is added as the Windows environment variable.

Type "environment" in the search bar.

click on -> Edit the system environment variables -> Advanced -> Environment Variables => Pop up following window

post-maven-javahome

2. Download Apache Maven

Visit Maven official website, download the Maven zip file, for example : apache-maven-3.5.3-bin.zip. Unzip it to the folder you want to install Maven.

Assume you unzip to this folder - C:\Program Files\Apache\maven

Note

That is all, just folders and files, installation is NOT required.

3. Add M2_HOME and MAVEN_HOME

Add both M2_HOME and MAVEN_HOME variables in the Windows environment, and point it to your Maven folder.

post-maven-mavenhome

M2_HOME or MAVEN_HOME

Maven document said add M2_HOME only, but some programs still reference Maven folder with MAVEN_HOME, so, it’s safer to add both.

4. Add To PATH

Update the PATH variable, append Maven bin folder – %M2_HOME%\bin, so that you can run the Maven’s command everywhere.

post-maven-m2path

5. Verification

Done, to verify it, run mvn –version in the command prompt.

$ mvn -version

Apache Maven 3.5.3 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T00:58:13-07:00)
Maven home: Maven home: C:\Program Files\Apache\maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_151\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

If you see a similar message, means the Apache Maven is installed successfully on Windows.

Thanks mkyong for reference.

The Unix Command Line

The Unix Command Line

Welcome to The Unix Workbench!

Working with Unix

Prints a phrase to the console

echo 'Hello World!'

print working directory

# print the working directory
pwd

# list the files and folders in a directory
ls

change working directory

The root directory (/) contains all of the folders and files on your computer.

Your home directory (~) is the directory where your terminal always starts.

To use cd to change your working directory to a directory other than your home directory, you need to provide cd with the path to another directory as an argument. You can specify a path as either a path:

  • relative to your current directory,
  • absolute path to a directory starting from the root of your computer.
# relative path to the Music folder
cd Music
# absolute path to the music folder
cd /users/stephen/music
cd ~/Music

. is the path to your current working directory, so cd Music is the same as cd ./Music

.. is a relative path, going to the directory above the current working directory with the command cd ..

Use cd to any folder as long as know the absolute path to that folder. Remember that ~ is a shortcut for the path to your home folder, so cd /Users/stephen/Music is the same as cd ~/Music

Note: Pressing tab shows you a list of all files and folders inside of the current directory. Or add letters to the path, only folders with names that start with letters are listed.

Creation and Inspection

# create a new folder
mkdir Photo
# create a new file
touch 2018.txt
# create a new file using output redirection
echo "I'm in the file." > 2018.txt
# append text to the end of a file
echo "I have been appended." >> 2018.txt

# long list
ls -l

# word count to display lines, words, and characters of file
wc 2018.txt

# print (concatenate) text files to the terminal
cat 2018.txt
cat 2018.txt 2018.txt

# view multi-page for large file
less 2018.txt

# glimpse the beginning or end of a text file
head 2018.txt
tail 2018.txt
# specify the number of lines printed
head -n 4 Documents/2018.txt

# file editor
nano
vim
emacs

moving, renaming, copying**, and **deleting files and folders

# move file to a folder
mv 2018.txt Journal
# move folder to folder
mv Journal Documents

# rename 2018.txt to todo.txt
mv 2018.txt todo.txt

# copy file
cp todo.txt Desktop
# copy folder
cp -r Documents Desktop

# remove file
rm todo.txt
# remove folder
rm -r Desktop/Documents

Self-Help

# take a look at the documentation for the list
man ls

# to start a search
/

# get back to the prompt
q

# search all of the available commands and their descriptions
apropos

Get Wild

The * (“star”) wildcard represents zero or more of any character, and it can be used to match names of files and folders in the command line.

# list all of the files which have a name that starts with “2017”:
ls 2018*
# list only the files with names ending in .jpg:
ls *.jpg
# list containing 01 in the name:
ls *2018*
# move the files using wildcards:
mv 2018* 2018/
# list the files:
ls 2018/

Search

Regular expression, grep requires two arguments: a regular expression and a text file to search.

# search for the state names that contain the word “New”
grep "New" states.txt

## The "." (period) metacharacter, which represents any character.
# search for the character “i”, followed by any character, followed by the character “g”
grep "i.g" states.txt

## The "+" (plus) represents one or more occurrences of the proceeding expression.
# search for one or more “s” followed by “as”
grep "s+as" states.txt

## The "*" (star) metacharacter which represents zero or more occurrences of the preceding expression. 
# search for zero or more “s” followed by “as”
grep "s*as" states.txt

## Curly brackets ({ }) to specify an exact number of occurrences of an expression.
# search  for exactly two occurrences of the character “s”
grep "s{2}" states.txt
# search for having between two and three adjacent occurrences of the letter “s”
grep "s{2,3}" states.txt

## Parentheses ("( )") to create capturing groups within regular expressions.
# search for the string “iss” occurring twice
grep "(iss){2}" states.txt
# search for three occurrences of an “i” followed by two of any character:
grep "(i.{2}){3}" states.txt

## The \w metacharacter corresponds to all “word” characters. \W for non-words.
# search for characters
grep "\w" states.txt
# returned strings all contain non-word characters.
grep "\W" states.txt

## The -v flag (which stands for invert match) makes grep return all of the lines not matched by the regular expression.
# compliment of grep
grep -v "\w" states.txt

## The \d metacharacter corresponds to all “number” characters. \D for non-digits.
# search for numbers
grep "\d" states.txt
# search space

## The \s metacharacter corresponds to all “space” characters. \S for non-spaces.
grep "\s" states.txt

## Square brackets ([ ]) to  create specific character sets.
# search for the set of vowels is [aeiou]
grep "[aeiou]" states.txt

## The complement of a set by including a caret (^) in the beginning of a set. 
# search for contains at least one non-vowel
grep "[^aeiou]" states.txt

## Range of characters you can use a hyphen (-) inside of the square brackets.
# search for all of the lowercase letters between “e” and “q”
grep "[e-q]" states.txt
# search for all of the uppercase letters between “e” and “q”
grep "[E-Q]" states.txt
# search for all letters between “e” and “q” ignore case
grep "[e-qE-Q]" states.txt

## Backslash () before the plus sign in a regex, in order to “escape” the metacharacter functionality
grep "\+" states.txt
grep "\." states.txt

## The caret (^), which represents the start of a line, and the dollar sign ($) which represents the end of line.
grep "^M" states.txt

mnemonic: “First you get the power, then you get the money.” The caret character is used for exponentiation in many programming languages, so “power” (^) is used for the beginning of a line and “money” ($) is used for the end of a line.

## The “or” metacharacter (|), which is also called the “pipe” character.
grep "North|South" states.txt
grep "North|South|East|West" states.txt

## Display the line number that a match occurs on using the -n flag
grep -n "t$" states.txt

# can also grep multiple files at once by providing multiple file arguments
grep "New" states.txt canada.txt

# both begin and end with a vowel
grep "^[AEIOU]{1}.+[aeiou]{1}$" states.txt
Metacharacter Meaning
. Any Character
\w A Word
\W Not a Word
\d A Digit
\D Not a Digit
\s Whitespace
\S Not Whitespace
[def] A Set of Characters
[^def] Negation of Set
[e-q] A Range of Characters
^ Beginning of String
$ End of String
\n Newline
+ One or More of Previous
* Zero or More of Previous
? Zero or One of Previous
| Either the Previous or the Following
{6} Exactly 6 of Previous
{4, 6} Between 4 and 6 or Previous
{4, } More than 4 of Previous

Find

find . -name "states.txt"
find . -name "*.jpg"

History

history
# take a look at the beginning of this file
head -n 5 ~/.bash_history
grep "canada" ~/.bash_history

# creates a shorter name for a command
# creates new command docs.
alias docs='cd ~/Documents'
# creates the command edbp (edit bash profile) so that you can quickly add aliases.
alias edbp='nano ~/.bash_profile'
# edit our ~/.bash_profile with nano. Add the line alias docs='cd ~/Documents', then save the file and quit nano. 
# make the changes to our ~/.bash_profile take effect we need to run
source ~/.bash_profile

Differentiate

# make two small simple text files in the Documents directory.
cd ~/Documents
head -n 4 states.txt > four.txt
head -n 6 states.txt > six.txt
# lines in these files are different we can use the diff 
diff four.txt six.txt
# compare differing lines in a side-by-side comparison using sdiff:
sdiff four.txt six.txt

Pipe

## The pipe (|) takes the output of the program on its left side and directs the output to be the input for the program on its right side.
# cat canada.txt | head -n 5
cat canada.txt | head -n 5
# How many state names that end with a vowel,
grep "[aeiou]$" states.txt | wc -l
ls -al | grep "Feb" | less

Make

cd ~/Documents/Journal
nano makefile
make draft_journal_entry.txt
# update our makefile with nano to automatically generate a readme.txt:
nano makefile
draft_journal_entry.txt:
  touch draft_journal_entry.txt
  
readme.txt: toc.txt
  echo "This journal contains the following number of entries:" > readme.txt
  wc -l toc.txt | egrep -o "[0-9]+" >> readme.txt
make readme.txt

Bash Programming

variable

Rules

  • Every character should be lowercase.
  • The variable name should start with a letter.
  • The name should only contain alphanumeric characters and underscores (_).
  • Words in the name should be separated by underscores.
# Notice that there are no spaces on either side of the equals sign
chapter_number=5
# print the data in a variable
echo $chapter_number
# modify the value of a variable
let chapter_number=$chapter_number+1
# store strings in variables
the_empire_state="New York"
# store the result of that command in a variable
math_lines=$(cat math.sh | wc -l)
# Variable names with a dollar sign can also be used inside other strings
echo "I went to school in $the_empire_state."

# The first argument to your script is stored in $1, the second argument is stored in $2, etc, etc. 
# An array of all of the arguments passed to your script is stored in $@
# The total number of arguments passed to your script is stored in $#
#!/usr/bin/env bash
# File: vars.sh
echo "Script arguments: $@"
echo "First arg: $1. Second arg: $2."
echo "Number of arguments: $#"

bash vars.sh red blue green
## Script arguments: red blue green
## First arg: red. Second arg: blue.
## Number of arguments: 3

user input

#!/usr/bin/env bash
# File: letsread.sh
echo "Type in a string and then press Enter:"
read response
echo "You entered: $response"

Logic and if/else

# The exit status of a program is an integer, the exit status of the last program run is stored in the question mark variable ($?).
echo $?

# true has an exit status of 0 and false has an exit status of 1
true
echo $?
## 0

false
echo $?
## 1

#  the program on the right hand side of && will only be executed if the program on the left hand side of && has an exit status of 0
true && echo "Program 1 was executed."
false && echo "Program 2 was executed."
false && true && echo Hello
echo 1 && false && echo 3
echo Athos && echo Porthos && echo Aramis
## Program 1 was executed.
## 1
## Athos
## Porthos
## Aramis

#  Commands on the right-hand side of || are only executed if the command on the left-hand side fails
true || echo "Program 1 was executed."
false || echo "Program 2 was executed."
false || echo 1 || echo 2
echo 3 || false || echo 4
echo Athos || echo Porthos || echo Aramis
## Program 2 was executed.
## 1
## 3
## Athos

echo Athos || echo Porthos && echo Aramis
echo Gaspar && echo Balthasar || echo Melchior
## Athos
## Aramis
## Gaspar
## Balthasar

# Conditional expressions either compare two values, or they ask a question about one value. Conditional expressions are always between double brackets ([[ ]]), and they either use logical flags or logical operators. 
[[ 4 -gt 3 ]]
echo $?
## 0
[[ 3 -gt 4 ]]
echo $?
## 1

# use the AND and OR operators so that an expression will print “t” if it’s true and “f” if its false:
[[ 4 -gt 3 ]] && echo t || echo f
[[ 3 -gt 4 ]] && echo t || echo f
## t
## f

There are several other varieties of logical flags

Logical Flag Meaning Usage
-gt Greater Than [[ $planets -gt 8 ]]
-ge Greater Than or Equal To [[ $votes -ge 270 ]]
-eq Equal [[ $fingers -eq 10 ]]
-ne Not Equal [[ $pages -ne 0 ]]
-le Less Than or Equal To [[ $candles -le 9 ]]
-lt Less Than [[ $wives -lt 2 ]]
-e A File Exists [[ -e $taxes_2016 ]]
-d A Directory Exists [[ -d $photos ]]
-z Length of String is Zero [[ -z $name ]]
-n Length of String is Non-Zero [[ -n $name ]]

Here’s a table of some of the useful logical operators in case you need to reference how they’re used later:

Logical Operator Meaning Usage
=~ Matches Regular Expression [[ $consonants =~ [aeiou] ]]
= String Equal To [[ $password = "pegasus" ]]
!= String Not Equal To [[ $fruit != "banana" ]]
! Not [[ ! "apple" =~ ^b ]]

One of the fundamental constructs in Bash programming is the IF statement.

#!/usr/bin/env bash
# File: nested.sh

if [[ $1 -gt 3 ]] && [[ $1 -lt 7 ]]
then
  if [[ $1 -eq 4 ]]
  then
    echo "four"
  elif [[ $1 -eq 5 ]]
  then
    echo "five"
  else
    echo "six"
  fi
else
  echo "You entered: $1, not what I was looking for."
fi

Arrays

Arrays in Bash are ordered lists of values. Lists are created with parentheses (( )) with a space separating each element in the list.

plagues=(blood frogs lice flies sickness boils hail locusts darkness death)
#  To get the first element of this array
echo ${plagues[0]}
# To get all of the elements of plagues use a star (*) 
echo ${plagues[*]}
# change an individual elements
plagues[4]=disease
# get 3 array elements starting from the sixth element of the array (remember, the sixth element has an index of 5).
echo ${plagues[*]:5:3}
find the length of an array using the pound sign (#)
echo ${#plagues[*]}
# use the plus-equals operator (+=) to add an array onto the end of an array array
plagues+=(bashful dopey happy)

Braces

# Brace expansion uses the curly brackets and two periods ({ .. }) to create a sequence of letters or numbers.
echo {0..9}
echo {a..e}
echo {W..Z}
echo a{0..4}
echo b{0..4}c
echo {1..3}{A..C}
## 1A 1B 1C 2A 2B 2C 3A 3B 3C
start=4
end=9
echo {$start..$end}
eval echo {$start..$end}
## {4..9}
## 4 5 6 7 8 9
echo { {1..3}, {a..c} }
## 1 2 3 a b c
echo {Who,What,Why,When,How}?
## Who? What? Why? When? How?

Loops

# File: forloop.sh
echo "Before Loop"
for i in {1..3}
do
    echo "i is equal to $i"
done

for the picture in img001.jpg img002.jpg img451.jpg
do
    echo "picture is equal to $picture"
done

echo ""
echo "Array:"
stooges=(curly larry moe)
for stooge in ${stooges[*]}
do
    echo "Current stooge: $stooge"
done

echo ""
echo "Command substitution:"
for code in $(ls)
do
    echo "$code is a bash script"
done
echo "After Loop"


# File: whileloop.sh
count=3
while [[ $count -gt 0 ]]
do
  echo "count is equal to $count"
  let count=$count-1
done


# File: nestedloops.sh
for number in {1..3}
do
  for letter in a b
  do
    echo "number is $number, letter is $letter"
  done
done

# File: ifloop.sh
for number in {1..10}
do
  if [[ $number -lt 3 ]] || [[ $number -gt 8 ]]
  then
    echo $number
  fi
done

Functions

function [name of function] {
  # code here
}

# File: hello.sh
function hello {
  echo "Hello"
}

# File: addseq.sh
function addseq {
  sum=0
  for element in $@
  do
    let sum=sum+$element
  done
  echo $sum
}

# we’re going to start using the source command, which allows us to use function definitions in bash scripts as command-line commands.
source addseq.sh

# The local keyword ensures that variables outside of our function are not overwritten by our function.

# File: addseq2.sh
function addseq2 {
  local sum=0
  for element in $@
  do
    let sum=sum+$element
  done
  echo $sum
}

Making Programs Executable

ls -l | head -n 3
## -rw-rw-r-- 1 sean sean 138 Jun 26 12:51 addseq.sh
## -rw-rw-r-- 1 sean sean 146 Jun 26 14:45 addseq2.sh
## -rw-rw-r-- 1 sean sean 140 Jan 29 10:06 bigmath.sh

# make this file executable and we’re the owner of this file
chmod u+x short

# To run an executable file we need to specify the path to the file, even if the path is in the current directory, meaning we need to prepend ./ to short.
./short

Excluding the first hyphen, we have the following string: rw-rw-r--. This string reflects the permissions that are set up for this file. There are three permissions that we can grant: the ability to read the file (r), write to or edit the file (w), or execute the file (x) as a program.

These three permissions can be granted on three different levels of access which correspond to each of the three sets of rwx in the permissions string: the owner of the file, the group that the file belongs to, and everyone other than the owner and the members of a group.

Set the permissions for files that you own using the chmod command. The chmod command takes two arguments. The first argument is a string that specifies how we’re going to change permissions for a file, and the second argument is the path to the file.

First, we can specify which set of users we’re going to change permissions for:

Character Meaning
u The owner of the file
g The group that the file belongs to
o Everyone else
a Everyone above

We then need to specify whether we’re going to add, remove, or set the permission:

Character Meaning
+ Add permission
- Remove permission
= Set permission

Finally, we specify what permission we’re changing:

Character Meaning
r Read a file
w Write to or edit a file
x Execute a file

Shell commands

To use our scripts and functions as shell commands.

The PATH variable contains a sequence of paths on our computer separated by colons. When the shell starts it searches these paths for executable files, and then makes those executable commands available in our shell.

One approach to making our scripts available is to add a directory to the PATH. Bash scripts in the directory that are executable can be used as commands. We need to modify PATH every time we start a shell, so we can amend our ~/.bash_profile so that our directory for executable scripts is always in the PATH. To modify an environmental variable we need to use the export keyword.

# HOME variable contains the path to our home directory.
echo $HOME
# PWD variable contains the path to our current directory.
echo $PWD
# If we want one of our functions to be available always as a command then we need to change the PATH variable.
echo $PATH

# create a new directory called Commands in our Code directory and add a line to our ~/.bash_profile so that Commands are added to the PATH.
mkdir Commands
nano ~/.bash_profile

alias docs='cd ~/Documents'
alias edbp='nano ~/.bash_profile'

export PATH=~/Code/Commands:$PATH

# Save ~/.bash_profile and close nano. Now let’s source our Bash profile (we only need to do this once) and move short into the Commands directory. Then we should be able to use short as a command!
source ~/.bash_profile
short

# Alternatively to making individual scripts executable we can add a source command to our ~/.bash_profile so that we can use a Bash function on the command line.
nano ~/.bash_profile

alias docs='cd ~/Documents'
alias edbp='nano ~/.bash_profile'

export PATH=~/Code/Commands:$PATH
source ~/Code/addseq2.sh

# Save the ~/.bash_profile, quit nano, and now let’s source our ~/.bash_profile so we can test if we can use addseq2.
source ~/.bash_profile
addseq2 9 8 7

Deploy Maven Project as Server

How to Deploy Maven Project as Server with Tomcat

Note: I will call the demo Maven project as Maxwell for convenience in the following article.

To deploy a maven project as a remote server with Tomcat, to avoid run maven project every time:

$ cd [to your checkout location] 
# For example, cd C:\GitProjects\Maxwell
$ mvn spring-boot:run

If you want to do so, please do the following steps

Three changes in Maven Project

  • Package your application as a WAR instead of JAR in pom.xml
    <packaging>war</packaging>
  • Mark the embedded Tomcat container a 'provided' dependency in pom.xml
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
  • The SpringBootApplication.java class has to extend SpringBootServletInitializer
@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(BookingDemoApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }
}
  • (Option) Define the package name in pom.xml
<build>
    <finalName>Maxwell</finalName>
</build>

Generate WAR file of maven project

Clone maven project repository

$ git clone https://github.com/zhongqi1112/Maxwell.git

Package Maxwell

$ cd [to your checkout location] 
# For example: cd C:\GitProjects\Maxwell
$ mvn package

A Maxwell.war file will be generated in .\Maxwell\target to get ready to deploy to the server.

Installation of Tomcat

Download Tomcat

Tomcat 8.5.32: we are going to use Tomcat 8.5.32 as a server, click 32-bit/64-bit Windows Service Installer

tomcatDownload

Setting up

  • Select Full type of install

    tomcatInstall01

  • Set three available ports, the default port is 8085, I set 8090 as the HTTP connector port.

  • Set username and password for the administrator to manage
    tomcatInstall02

  • Select the correct path of JRE, for example, C:\Program Files\Java\Jre1.8.0
    tomcatInstall03

  • Select the path to install Tomcat, if you install in C:\Program Files you need to change permissions when you want to modify the configuration.

    tomcatInstall04

Check installation

  • Go to the window search bar and search services, you will see Apache Tomcat 8.5 in the services list, right-click and select Properties. You will see Tomcat is Running and startup Automatic
    tomcatServer01

  • Go to the setup port to check install Tomcat successfully, for example, http://localhost:8090/, you will see the window like this:
    tomcatServer02

Deploy Maven Project to Tomcat server

  • Go to the setup Tomcat server port, for example, http://localhost:8090/

  • Click on Manager App and enter the username and password you set up during installation
    tomcatManagerApp

  • Click on Choose File, selecting the Maxwell.war was generated, and then click on Deploy.

  • Wait for a few seconds, you will see Maxwell is running in the Applications list.
    tomcatManagerApplications

  • Go and check it in the browser, http://localhost:8090/Maxwell/uciMessageType, you will see all UCI messages in the database. Or use your IP address instead of localhost.

Configuration of Tomcat

Change permissions

  • Go to the folder installed Tomcat, C:\Program Files\Apache Software Foundation

  • Right click on Tomcat8.5 folder, select Properties -> Security -> Edit

  • Allow Full control

Change users' information

  • Go to the folder installed Tomcat, C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf
  • Open tomcat-users.xml to modify users' username or password, for example
    <user username="tomcat" password="tomcat" roles="admin-gui,manager-gui" />
  • If you reset infomation of users, you need to stop and start server.

Change port

  • Go to the folder installed Tomcat, C:\Program Files\Apache Software Foundation\Tomcat 8.5\conf

  • Open server.xml, approximate line 69, you could change the port 8090 of the server to any available port.
    <Connector port="8090" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

  • If you reset the port of the server, you need to stop and start server.

Start or Stop server

  • Start the server in command prompt
$ cd [the appropriate subdirectory of the EDQP Tomcat installation directory]
# For example, C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin
$ startup.bat
# Verify that the service was started correctly by looking for the final server startup messages.
  • Stop server in command prompt
$ cd [the appropriate subdirectory of the EDQP Tomcat installation directory]
# For example, C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin
$ shutdown.bat
# Verify that the service was stopped correctly by looking for the final server shutdown messages.

You could check the youtube video I found online, thanks to Romanian Coder for providing the video.
if you get any questions feel free to email me.

Java Keywords

Introduce Important Java Keywords

static

Static is a non-access modifier in Java which is applicable for the following:

  • blocks
  • variables
  • methods
  • nested classes

When a member(block, variable, method, nested class) is declared static, it can be accessed before any objects of its class are created, and without reference to any object.

Static blocks

If you need to do the computation in order to initialize your static variables, you can declare a static block that gets executed exactly once, when the first time you make an object of that class or the first time you access a static member of that class (even if you never make an object of that class). Also, static blocks are executed before constructors.

Static variables

When a variable is declared as static, then a single copy of the variable is created and shared among all objects at class level. Static variables are, essentially, global variables. All instances of the class share the same static variable.

Important points for static variables:

  • We can create static variables at the class-level only. Unlike C/C++, static local variables are not allowed in Java.
  • Static block and static variables are executed in the order they are present in a program.

Static methods

When a method is declared with a static keyword, it is known as a static method. The most common example of a static method is main( ) method. As discussed above, Any static member can be accessed before any objects of its class are created, and without reference to any object. Methods declared as static have several restrictions:

  • They can only directly call other static methods.
  • They can only directly access static data.
  • They cannot refer to this or super in any way.

When to use static variables and methods?

Use the static variable for the property that is common to all objects. For example, in class Student, students share the same college name. Use static methods for changing static variables.

Can a class be static in Java ?
The answer is YES, we can have a static class in java. In java, we have static instance variables as well as static methods and also static blocks. Classes can also be made static in Java.

Java allows us to define a class within another class. Such a class is called a nested class. The class which enclosed the nested class is known as the Outer class. In java, we can’t make Top-level class static. Only nested classes can be static.

Nested Classes

n java, it is possible to define a class within another class, such classes are known as nestedclasses. They enable you to logically group classes that are only used in one place, thus this increases the use of encapsulation, and create more readable and maintainable code.

  • The scope of a nested class is bounded by the scope of its enclosing class. Thus in the above example, class NestedClass does not exist independently of class OuterClass.
  • A nested class has access to the members, including private members, of the class in which it is nested. However, the reverse is not true i.e. the enclosing class does not have access to the members of the nested class.
  • A nested class is also a member of its enclosing class.
  • As a member of its enclosing class, a nested class can be declared private, public, protected, or package private(default).
  • Nested classes are divided into two categories:
    1. static nested class: Nested classes that are declared static are called static nested classes.
    2. inner class: An inner class is a non-static nested class.

Syntax:

class OuterClass
{
...
    class NestedClass
    {
        ...
    }
}

Static nested classes

As with class methods and variables, a static nested class is associated with its outer class. And like static class methods, a static nested class cannot refer directly to instance variables or methods defined in its enclosing class: it can use them only through an object reference.
They are accessed using the enclosing class name.

OuterClass.StaticNestedClass

For example, to create an object for the static nested class, use this syntax:

OuterClass.StaticNestedClass nestedObject =
     new OuterClass.StaticNestedClass();

Inner classes

To instantiate an inner class, you must first instantiate the outer class. Then, create the inner object within the outer object with this syntax:

OuterClass.InnerClass innerObject = outerObject.new InnerClass();

There are two special kinds of inner classes:

  1. Local inner classes
  2. Anonymous inner classes

What are the differences between static and non-static nested (inner) classes?
The following are major differences between the static nested class and non-static nested class. A non-static nested class is also called Inner Class.

1) Nested static class doesn’t need a reference to Outer class, but Non-static nested class or Inner class requires Outer class reference.

2) Inner class(or non-static nested class) can access both static and non-static members of the Outer class. A static class cannot access non-static members of the Outer class. It can access only static members of the Outer class.

3) An instance of Inner class cannot be created without an instance of the outer class and an Inner class can reference data and methods defined in Outer class in which it nests, so we don’t need to pass the reference of an object to the constructor of the Inner class. For this reason, Inner classes can make the program simple and concise.

final

final keyword is used in different contexts. First of all, final is a non-access modifier applicable only to a variable, a method, or a class. The following are different contexts where the final is used.

Final variables

When a variable is declared with final keyword, its value can’t be modified, essentially, a constant. This also means that you must initialize a final variable. If the final variable is a reference, this means that the variable cannot be re-bound to reference another object, but an internal state of the object pointed by that reference variable can be changed i.e. you can add or remove elements from a final array or final collection. It is good practice to represent final variables in all uppercase, using underscore to separate words.

Initializing a final variable:
We must initialize a final variable, otherwise, the compiler will throw compile-time error. A final variable can only be initialized once, either via an initializer or an assignment statement. There are three ways to initialize a final variable :

  1. You can initialize a final variable when it is declared. This approach is the most common. A final variable is called blank final variable,if it is not initialized while declaration. Below are the two ways to initialize a blank final variable.
  2. A blank final variable can be initialized inside the instance-initializer block or inside the constructor. If you have more than one constructor in your class then it must be initialized in all of them, otherwise, a compile-time error will be thrown.
  3. A blank final static variable can be initialized inside a static block.

Let us see above different ways of initializing a final variable through an example.

//Java program to demonstrate differently 
// ways of initializing a final variable 
  
class Gfg  
{ 
    // a final variable 
    // direct initialize 
    final int THRESHOLD = 5; 
      
    // a blank final variable 
    final int CAPACITY; 
      
    // another blank final variable 
    final int  MINIMUM; 
      
    // a final static variable PI 
    // direct initialize 
    static final double PI = 3.141592653589793; 
      
    // a  blank final static  variable 
    static final double EULERCONSTANT; 
      
    // instance initializer block for  
    // initializing CAPACITY 
    { 
        CAPACITY = 25; 
    } 
      
    // static initializer block for  
    // initializing EULERCONSTANT 
    static{ 
        EULERCONSTANT = 2.3; 
    } 
      
    // constructor for initializing MINIMUM 
    // Note that if there are more than one 
    // constructor, you must initialize MINIMUM 
    // in them also 
    public GFG()  
    { 
        MINIMUM = -1; 
    } 
} 

When to use a final variable:

The only difference between a normal variable and a final variable is that we can re-assign value to a normal variable but we cannot change the value of a final variable once assigned. Hence final variables must be used only for the values that we want to remain constant throughout the execution of the program.

Reference final variable:
When a final variable is a reference to an object, then this final variable is called reference final variable. For example, a final StringBuffer variable looks like

final StringBuffer sb;

As you know that a final variable cannot be re-assign. But in the case of a reference final variable, the internal state of the object pointed by that reference variable can be changed. Note that this is not re-assigning. This property of final is called non-transitivity.

The non-transitivity property also applies to arrays, because arrays are objects in the java. Arrays with the final keyword are also called final arrays.

Note:

  1. As discussed above, a final variable cannot be reassigned.

  2. When a final variable is created inside a method/constructor/block, it is called the local final variable, and it must initialize once where it is created. See the below program for the local final variable.

  3. Note the difference between C++ const variables and Java final variables. const variables in C++ must be assigned a value when declared. For final variables in Java, it is not necessary as we see in the above examples. A final variable can be assigned value later, but only once.

  4. final with foreach loop: final with for-each statement is a legal statement.

    Explanation: Since the i variable goes out of scope with each iteration of the loop, it is actually re-declaration each iteration, allowing the same token (i.e. i) to be used to represent multiple variables.

Final classes

When a class is declared with final keyword, it is called a final class. A final class cannot be extended(inherited). There are two uses of a final class :

  1. One is definitely to prevent inheritance, as final classes cannot be extended. For example, all Wrapper Classes like Integer, Float, etc. are final classes. We can not extend them.
  2. The other use of final with classes is to create an immutable class like the predefined String class. You can not make a class immutable without making it final.

Final methods

When a method is declared with final keyword, it is called a final method. A final method cannot be overridden. The Object class does this—a number of its methods are final. We must declare methods with the final keyword for which we required to follow the same implementation throughout all the derived classes.

Scope

The scope of a variable is the part of the program where the variable is accessible.

Member variables

These must be declared inside the class (outside any function). They can be directly accessed anywhere in the class.

  • We can declare class variables anywhere in class, but outside methods.
  • Access specified of member variables doesn’t affect the scope of them within a class.
  • Member variables can be accessed outside a class with following rules
Modifier      Package  Subclass  World

public          Yes      Yes     Yes

protected       Yes      Yes     No

Default (no
modifier)       Yes       No     No

private         No        No     No

Local Variables (Method Level Scope)

Variables declared inside a method have the method-level scope and can’t be accessed outside the method.

Note: Local variables don’t exist after the method’s execution is over. Except the variable got passed in as a parameter to the method

Loop Variables (Block Scope)

A variable declared inside pair of brackets “{” and “}” in a method has scope within the brackets only.

Some Important Points about Variable scope in Java:

  • In general, a set of curly brackets { } defines a scope.
  • In Java, we can usually access a variable as long as it was defined within the same set of brackets as the code we are writing or within any curly brackets inside of the curly brackets where the variable was defined.
  • Any variable defined in a class outside of any method can be used by all member methods.
  • When a method has the same local variable as a member, this keyword can be used to reference the current class variable.
  • For a variable to be read after the termination of a loop, It must be declared before the body of the loop.

License

MIT License Copyright (c) 2018 By Stephen Wang

References:

Leetcode Bootcamp

Leetcode Bootcamp

Day 1 Array

704. Binary Search

Condition of loop can not change

  1. while(left<=right) {} // [left, right]
  2. while(left< right) {} // [left, right)

27. Remove Element

  • slow-fast pointer

Day 2 Array

977. Squares of a Sorted Array

  • two pointers

209. Minimum Size Subarray Sum

  • sliding window

59. Spiral Matrix II

Day 3 Linked list

203. Remove Linked List Elements

707. Design Linked List

206. Reverse Linked List

Day 4 Linked list

24. Swap Nodes in Pairs

19. Remove Nth Node From End of List

160. Intersection of Two Linked Lists

142. Linked List Cycle II

Day 5 Break


Day 6 Hash table

When we encounter the need to quickly determine whether an element appears in a set, we must consider the hash table.

  • array
  • set
  • map

242. Valid Anagram

  • use array as a hash table

349. Intersection of Two Arrays

202. Happy Number

1. Two Sum

Day 7 Hash table

454. 4Sum II

383. Ransom Note

15. 3Sum

18. 4Sum

Create WebSocket Project

Create a WebSocket Project

I am going to show you how to create a WebSocket project using the spring boot framework.

Create a Maven Project

Create a maven project and add WebSocket as a dependency on pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

WebSocket Config class

Create a WebSocketConfig.java class

package com.company.websocket;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

/**
 * WebSocket configuration
 */
@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {

   /**
    * WebSocket declaration for service.
    *
    * @return client connection handler.
    */
   @Bean
   public WebSocketHandler clientHandler() {
      return new WebSocketHandler();
   }

   @Override
   public final void registerWebSocketHandlers(
         final WebSocketHandlerRegistry registry) {
      registry.addHandler(clientHandler(), "/websocketserver").setAllowedOrigins("*");
   }
}

Create WebSocketHandler class

Create a WebSocketHandler.java class in the same folder

package com.company.websocket;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

@Component
public class WebSocketHandler extends TextWebSocketHandler {

   private final static Map<String, WebSocketSession> sessions;

   static {
      sessions = new ConcurrentHashMap<String, WebSocketSession>(30);
   }

   @Override
   public void afterConnectionEstablished(WebSocketSession session) throws Exception {
      this.sessions.put(session.getId(), session);
      System.out.println("New WebSocket user {} is connected", () -> session.getId());
   }

   @Override
   public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
      System.out.println("WebSocket user {} is disconnected", () -> session.getId());
      this.sessions.remove(session.getId());
   }

   @Override
   protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
      String payload = message.getPayload();
      System.out.println("Receive message from user {}, message is: {}", () -> session.getId(), () -> payload);
   }

   @Override
   public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
      System.out.println("Transport Error: {}", () -> exception.getMessage());
   }

   /**
    * Send a message to a designated WebSocket client
    *
    * @param userId every user connect to the WebSocket server have an identify id used for user-id
    * @param contents message need to be sent to the user
    */
   public void sendMessageToUser(String userId, String contents) {
      WebSocketSession session = sessions.get(userId);
      if (session != null && session.isOpen()) {
         try {
            TextMessage message = new TextMessage(contents);
            session.sendMessage(message);
            System.out.println("WebSocket send message to user {}, the message is: {}", () -> session.getId(), () -> contents);
         } catch (IOException e) {
            e.printStackTrace();
         }
      }
   }

   /**
    * Send a message to all WebSocket client
    *
    * @param contents message need to be sent to the user
    */
   public void sendMessageToAllUsers(String contents) {
      Set<String> userIds = sessions.keySet();
      System.out.println("WebSocket send message to all users, the message is: {}", () -> contents);
      userIds.forEach((userId) -> {
         this.sendMessageToUser(userId, contents);
      });
   }
}

Client WebSocket Code

Create a js file to handle the WebSocket client side.

export default () => {
      var websocket = null
      // if browser supports WebSocket
      if ('WebSocket' in window) {
        websocket = new WebSocket(webSocketUrl)
        console.log('Connecting to WebSocket Server')
      } else {
        // if browser does not support WebSocket
        console.error('Browser does not support WebSocket')
      };

      /**
       * an event listener for when WebSocket connection is error
       */
      websocket.onerror = function () {
        console.error('WebSocket connection Error')
      }

      /**
       * an event listener for when WebSocket connection is open
       */
      websocket.onopen = function (event) {
        console.log('WebSocket connection opened. URL: ' + event.target.url)
        websocket.send("This is an user connecting to Websocket")
      }

      /**
       * an event listener for when a message is received from the WebSocket server
       */
      websocket.onmessage = function (event) {
        console.log('Message received from WebSocket server: ' + event.data)
        var jsonObject = JSON.parse(event.data)
        console.log(jsonObject)
      }

      /**
       * an event listener for when WebSocket connection is close
       */
      websocket.onclose = function () {
        console.log('WebSocket connection closed.')
      }

      /**
       * close WebSocket connection when close window
       */
      window.onbeforeunload = function () {
        console.log('WebSocket connection closed due to Window closed.')
        websocket.close()
      }
      
      /**
      * this function should be called when users want to send any command to the server via WebSocket in JSON.
      * @message the message send to the WebSocket server from the client
      */
      function sendMessageObject (message) {
        var messageObject = JSON.stringify(message)
        console.log('Send message to server: ' + messageObject)
        websocket.send(messageObject)
      }
}

Create user GUI

You could use any user GUI to hold this websocket.js to see messages in the console.

Git Command Prompt

Git

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git is easy to learn and has a tiny footprint with lightning-fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

Install Git

Download Git from git official website.

Working Flow

gitWorkFlow

Git Command

Need help

$ git help [verb]
$ git [verb] --help

Check git version

$ git --version

set or remove proxy

# set proxy
$ git config --global http.proxy http://64.128.256.512
$ git config --global https.proxy http://64.128.256.512

# remove proxy 
$ git config --global --unset http.proxy
$ git config --global --unset https.proxy

Set Configure values

Configure user information for all local repositories

# Sets the name and email you want attached to your commit transactions
$ git config --global user.name "StephenWang"
$ git config --global user.email “[email protected]”
# check configure list of git
$ git config --list

Initialize repositories

Start a new repository or obtain one from an existing URL

# Start a repository from existing code
$ cd c:/Git Projects/project
$ git init
# Creates a new local repository with the specified name
$ git init [project-name]
# Downloads a project and its entire version history
$ git clone [url]

Files in repository

Relocate and remove versioned files

# Create new file
$ touch [file]
# Deletes the file from the working directory and stages the deletion
$ git rm [file]
# Removes the file from version control but preserves the file locally
$ git rm --cached [file]
# Changes the file name and prepare it for commit
$ git mv [file-original] [file-renamed]
# Removes directory
$ rmdir [directory]

Save fragments

Shelve and restore incomplete changes

# Temporarily stores all modified tracked files
$ git stash
# Restores the most recently stashed files
$ git stash pop
# Lists all stashed changesets
$ git stash list
# Discards the most recently stashed changeset
$ git stash drop

Make changes

Review edits and craft a commit transaction

# Lists all new or modified files to be committed
$ git status
# Shows file differences not yet staged
$ git diff
# Snapshots the file in preparation for versioning
$ git add [file]
# Add files to staging area
$ git add .
# Shows file differences between staging and the last file version
$ git diff --staged
# Unstaged the file, but preserves its contents
$ git reset [file]
# Records file snapshots permanently in the version history
$ git commit -m"[descriptive message]"
# Push the changes in the local repository to Github
$ git remote add origin [url]
$ git push origin master
$ git push [url] master

Group changes

Name a series of commits and combine completed efforts

# Viewing infomation about the remote repository
$ git remote -v
# Lists all local branches in the current repository
$ git branch
# Creates a new branch
$ git branch [branch-name]
# Switches to the specified branch and updates working directory
$ git checkout [branch-name]
# Combines the specified branch’s history into the current branch
$ git merge [branch-name]
# Deletes the specified branch
$ git branch -d [branch-name]

Review history

Browse and inspect the evolution of project files

# Lists version history for the current branch
$ git log
# Lists version history for the file, including renames
$ git log --follow [file]
# Shows content differences between two branches
$ git diff [first-branch]...[second-branch]
# Outputs metadata and content changes of the specified commit
$ git show [commit]

Redo commits

Erase mistakes and craft replacement history

# Undoes all commits after [commit], preserving changes locally
$ git reset [commit]
# Discards all history and changes back to the specified commit
$ git reset --hard [commit]

Synchronize changes

Register a remote (URL) and exchange repository history

# Downloads all history from the remote repository
$ git fetch [remote]
# Combines the remote branch into the current local branch
$ git merge [remote]/[branch]
# Uploads all local branch commits to GitHub
$ git push [remote] [branch]
# Downloads bookmark history and incorporates changes
$ git pull
# DELETING A BRANCH
$ git branch -d [branch]
$ git branch -D [branch]

Note: There is an official git cheat sheet. you could look at it, I will explain in detail.

Github Desktop

GitHub provides desktop clients that include a graphical user interface for the most common repository actions and an automatically updating command line edition of Git for advanced scenarios.

Online Tutorial

There is an online tutorial on YouTube by The Net Ninja.

TortoiseGit

I recommend you use TortoiseGit instead of Git command prompt. TortoiseGit provides overlay icons showing the file status, a powerful context menu for Git and much more!

NPM and Yarn

NPM

add or remove proxy command prompt

# install npm
$ npm install
# check configure of npm
$ npm config list
# remove proxy 
$ npm config delete proxy
$ npm config delete http-proxy
$ npm config delete https-proxy
# set proxy (using DevlLAN)
$ npm config set proxy http://64.128.256.512
$ npm config set https-proxy http://64.128.256.512
# compile
$ npm run dev

Yarn

add or remove proxy command prompt

# install yarn
$ yarn install
# check configure of yarn
$ yarn config list
# disable ssl with
$ yarn config set strict-ssl false
# remove proxy
$ yarn config delete proxy
$ yarn config delete http-proxy
$ yarn config delete https-proxy
# set proxy (using DevlLAN)
$ yarn config set proxy http://64.128.256.512
$ yarn config set https-proxy http://64.128.256.512
# compile
$ yarn run dev

Deploy Vue Project as Server

How to Deploy Vue Project as Server with Tomcat

Note: I will call the demo vue project as Edison for convenience in the following article.

To deploy a vue project as a remote server with Tomcat, to avoid run vue-cli project every time:

$ cd [to your checkout location] 
# For example: cd C:\GitProjects\Edison
$ npm install
$ npm run dev

If you want to do so, please do the following steps

Package Edison

Clone Edison repository

$ git clone https://github.com/zhongqi1112/Edison.git

Configuration

Find Edison\config\index.js file change value of build.assetsPublicPath from '/' to './'

tomcatConfig

Package

$ cd [to your checkout location] 
# For example: cd C:\GitProjects\Edison
$ npm install
$ npm run build

You will see a dist folder in the root. There are static folder and index.html inside, these two get ready to deploy to the server.

tomcatDist

Installation of Tomcat

I introduced how to download, set up, and check the installation of Tomcat in another article, Installation of Tomcat, if you are not familiar with Tomcat please check it out.

Deploy Edison to Tomcat server

  • Create a folder called Edison in Tomcat folder, for example, .\Tomcat 8.5\webapps\Edison

  • Copy static folder and index.html in .\Edison\dist, and paste to the folder just created: .\Tomcat 8.5\webapps\Edison

    tomcatCopyPackage

  • Go to the setup Tomcat server port, for example, http://localhost:8090/

  • Click on Manager App and enter the username and password you set up during installation
    tomcatManagerApp

  • You will see Edison is running in the Applications list.
    tomcatManagerApplicationsEdison

  • Go and check it in the browser, http://localhost:8090/Edison, you will see vue project. Or use your IP address instead of localhost.

Deploy Config file to Tomcat server (Optional)

Note: Hosting config file external to Edison in Tomcat, and access the config file via relative URL. Since it's on the same server Edison can access it by relative URL.

  • Create a folder called static, this path should match with the config file in Edison repository, in the Tomcat folder, for example, Tomcat 8.5\webapps\static
  • Copy config file ewbmConfig.json in Edison\static, and paste to the folder just created: Tomcat 8.5\webapps\static
  • Check the config file works via URL: http://localhost:8090/static/Config.json
  • Any changes in the config file of the server, you need to click reload on both Edison and static in Tomcat.

tomcatReload

Configuration of Tomcat

I introduced how to change permissions of Tomcat, Change Tomcat users' information, change project port, and start or stop Tomcat server in my other article, Configuration of Tomcat

If you get any questions feel free to contact me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.