Posts

Showing posts from 2018

Machine Learning Numpy

1. how to create array using numpy : import numpy as np #ad array a=np.array([10,20,30]) // int,float ,String  // array should be homoginous #2 d array 3*3 b=np.array([ [1,2,12], [12,12,12], [12,34,5] ]) #3*3*3 c=np.array([ [[1,2,3],[4,5,6],[7,8,9]], [[4,5,6],[8,6,7],[5,6,7]], [[8,8,8],[9,9,9],[9,98,8]] ]) print(a) print(b) print(c) #Arrange Function : a = np.arange(10,20) //start value and end value print(a) [10........................19] a=np.arnage(10,20,2)

Exception Handaling In Spring

-------------------------------------------------------------------------------------------------------------------------- -  When The User Request for the web page then user get webpage as a Response. - Example    @Controller public class CommonController {     @RequestMapping("/")     public String homePage() {         return "home";     } ------------------------------------------------------------------------------------------------------------------------------- - Due to some developer mistake or some other reason if while processing the request if  the method throws some exception say Null Pointer , Resourcefulness or Any Other what user get in that case is ". HTTP Status 500 -   Brief description of the error which occurred on server. and related stack trace information.  - Example   @Controller public class CommonController {     @RequestMapping("/")     public String homePage() throws IOException{         S

SpringBoot CRUD Operation

 import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; @SpringBootApplication public class SpringBootJpaApplication {       public static void main(String[] args) {         SpringApplication.run(SpringBootJpaApplication.class, args);     }        } ---------------------------------------------------------------------------------------------------------------------- import javax.persistence.Column; import javax.persistence.Entity;  import javax.persistence.Id;  import javax.persistence.Table; @Entity  @Table(name="new1") public class UserRecord {      @Id      private int id;     @Column     private String name;     @Column     private String email;      public UserRecord(){}      public int getId() {          return id;      }      public void setId(int id) {          this.id = id;      }      public String

@Component Scan Annotation Spring

 Auto Binding Object ================================== <?xml version='1.0' encoding='UTF-8' ?> <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:context="http://www.springframework.org/schema/context"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:mvc="http://www.springframework.org/schema/mvc"     xsi:schemaLocation="         http://www.springframework.org/schema/beans             http://www.springframework.org/schema/beans/spring-beans.xsd         http://www.springframework.org/schema/context         http://www.springframework.org/schema/context/spring-context.xsd ">     <context:component-scan base-package="com.hello"/>     <context:component-scan base-package="com.model"/> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">         <property name="viewClass" value="or

Liner Regression Solved Example for ML

Image
Formula : Y=aX+b So first we calculate a and b a=n* summation(xy)-summation(x)*summation(y) / n* summation(x*x)- summation(x*x) b=1/n * (summation(y)- a * summation(x))

Naive Bayes Algorithm For Machine Learning..working

Image
                        

Mysql Hosting Comming Soon

https://www.freemysqlhosting.net

JSP Automatic Redirect After Session Expire/Timeout

 Steps : 1.Create index.jsp and write below code ================================================ <html>     <head>         <META HTTP-EQUIV="refresh" CONTENT="<%= session.getMaxInactiveInterval() %>; URL=error.jsp" />         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>JSP Page</title>     </head>     <body>         </body> </html> ================================================== 2.create error.jsp ================================================== 3. in web.xml write below entry of session in minit  <session-config>         <session-timeout>             1         </session-timeout>     </session-config> ================================================== 4.run index.jsp and wait for 1 minit , after one minit automatically error page display. ================================================

Hibernate Named Queries With Annotation- Comming Soon

Hibernate Named Queries With XML- Comming Soon

Component Mapping With Annotation

When we want to store one class object as value to another class object then we have to use component mapping For Component mapping we have two annotations. 1. Embedable 2.Embeded A class whose object we want to store like a value of another class object should be annotated with ======> @Embedable To the reference variable of embedable class we need to as ===> @Embeded annotation  =============================================== @Embeddable public class Address {     int hno;     String city; } ================================================ @Entity @Table public class Student {     @Id     int id;     @Column     String  name;     @Embedded Address address; ===============================================

Component Mapping In Hibernate with XML

If we want to store one class object at a value of another class object, then we use component mapping. To use Component mapping the two classes should  have 'has-a' relation between them. In hbm file to map a Component to a table of a database then we have <Component> tag. Ex : public class Employee{       int id; String name; Address address;                   } class Address{ int hno; String street; String city; } hbm file: ====================================== <hibernate-mapping>     <class name="hibernate1.Student" table="finalst">         <id name="id"></id>         <property name="name"></property>         <component name="address">             <property name="hno"/>   <property name="street"/>             <property name="city"/>         </component>            </class>  </hibernate-m

Dialect In Hibernate

Dialect are used to provide information to hibernate about in which SQL command it translate your HQL and Criteria command because SQL is database dependent language and changes from database to database … so to convert our HQL or criteria into a suitable SQL based on database dialect.

Criteria API- Hibernate Notes

To perform bulk select operation we use this criteria API. Criteria API means we use criteria interface and we call methods of criteria interface  for reading entities from the database. Criteria API can be used only for select operation, we can not perform non select operation using criteria. In criteria API , there will be less burden  on programmer because query tuning will be taken care by hibernate only. To select entities from database using criteria API hen we need criteria object. We can create criteria object  by calling createCriteria method of session interface ex:              List list=session.createCriteria(Student.class); Using criteria API we can read entities from database in following ways 1. If we want to read full entities form database by without applying any conditions then we need to directly call list method on criteria object.                            List list=crit.list(); =============================================== 2. If we wan
Image
APRIORY

K-Mean Clustering

Image
Clustering comes under unsupervised learning algorithm :  for clustering algorithm uses are  : k- mean clustering   clustering is the process of partitioning group of data points into small number of clusters k means is a clustering method that aims to find the position of the  cluster that minimize the distance from data points to the  cluster k-means clustering is one of the simplest algorithms which uses unsupervised learning method to solve known clustering issues. k-means clustering require following two inputs. k = number of clusters Training set(m) = {x1, x2, x3,……….., xm} Let’s say you have an unlabeled data set like the one shown below and you want to group this data into clusters. take mean value find nearest number and mean and put into cluster repeat one and two until we not get same mean example : {2,3,4,10,11,12,20,25,30} data set creating two cluster m1=4 m2=12 k1={2,3,4,} m1=3 k2={10,11,12,20,25,30} m2=18 ========================

Simple and Easy Way To Install Python On Linux

Here is Steps  : First Download python from Python.org cd downloads ls ./configure sudo make sudo make install sudo apt-get install  libssl.dev openssl Enjoy : 

No Logic Only Magic. Python

Learn Python for data science  ; Java  -  int a=10;             int b=20            int temp; temp=a; a=b; b=temp; ===================================================== x=10 y=20 x,y=y,x ======================================================= String name="GOVIND" SOP(name) ================= English Statement : name="Govind" print(name) ====================================  

Eigen Value and Eigen Vecctor

Let A is the square matrix of order n*n ,then a number  lambda is set to be Eigen value of matrix A if there exists a column matrix  X of order   n*1 such that AX=lambdaX It menas that , if column matrix A , A*X= lambda*X then  lmbda is called eigen value of  A. X-eigen vector of A.  AX-lambdaX=0 A-(Lambda*I )X=0 Eigen Value - chrecteristics value Eigen Vector- Characteristic Vecor Working rule to find Eigen Value and Eigen Vector : First u need to create characteristic equations of matrix A, it is determinate of  | A-lambda *I| = 0 I - is the square matrix . Solutions of characteristics equations  is called Eigen values , on the basis of egen values  corespoing we can find egen vector .

Simple Linear Regression : Machine Learning Practical - Number Of experiance vs Salary

Image
- It is the Study of two variables. - One variable is called as In Dependent variable.(x) - And Other Variable is called as Dependent Variable(y)  Example : Salary dependent on Number Of experience U have. - So in this example we can say that : Salary  is dependent variable    and Experience is Independent variable. - It is used for predictions.  - Here  we try to predict  the change in dependent variable according to change in independent variable. Regression    y=a+bx; Here y is dependent variable and x is called as Independent Variable .                                  In this example sales is dependent on price  : sales dependents on prince  In this Example Salary is Dependent Variable and Number of Years of Experience is Independent.  Created on Fri May 25 18:53:42 2017 @author: Govind """ import numpy as mp #this library help to chart graphs import matplotlib.pyplot as plt import pandas as pd import os os.chdir('

Machine Learning : Linear regression

Image
    Linear regression attempts to model the relationship between two variables by fitting a linear equation to observed data.   One variable is considered to be an explanatory variable, and the other is considered to be a dependent variable.     Dependent Variable – Variable who’s values we want to explain or forecast Independent or explanatory Variable that Explains the other variable. Values are independent. Dependent variable can be denoted as y, so imagine a child always asking y is he dependent on his parents.    And then you can imagine the X as your ex boyfriend/girlfriend who is independent because they don’t need or depend on you. A good way to remember it.    Anyways Used for 2 Applications To Establish if there is a relation between 2 variables or see if there is statistically signification relationship between the two variables- • To see how increase in sin tax has an effect on how many cigarettes packs are consumed • Sleep hours vs

Machine Learning : Supervised vs Unsupervised Learning

Image
Wiki Supervised Learning Definition          Supervised learning is the Data mining task of inferring a function from labeled training data.The training data consist of a set of training examples. In supervised learning, each example is a pair consisting of an input object (typically a vector) and a desired output value (also called the supervisory signal). A supervised learning algorithm analyzes the training data and produces an inferred function, which can be used for mapping new examples. An optimal scenario will allow for the algorithm to correctly determine the class labels for unseen instances. This requires the learning algorithm to generalize from the training data to unseen situations in a “reasonable” way. Wiki Unsupervised Learning Definition In Data mining, the problem of unsupervised learning  is that of trying to find hidden structure in unlabeled data. Since the examples given to the learner are unlabeled, there is no error or reward signal to

Data Mining -[Data, Information, Knowlade,Architecture , Examples]

Image
1. Data mining is the process of analyzing data from different perspective and summarizing  it into useful information. 2. Data : Extracting knowledge  from large amount of  data is called data mining. ex u search google  , u get whatever u want with the help of data mining . gold mining. Data    fact or raw material , unprocessed things ex 250- currently it is data, it has no meaning.   Information -  processing the data : -processing means -  giving some meaning to data   Information inform you something. In other words ,it must have some meaning , at this stage you will processed your data  and put it into context. Take earlier example of data which was 250. we could now give it a meaning  that is we could say that it means 250 student  But this doesn't really inform us anything , now we need to put it into context. Now we can fully converted our data into information by not only saying 250 student , but by adding

Data Mining part -1 : Data Generate Per Day- 4 million terabyte

Each minute of every day the following happens on the internet: Social Media is HUGE – Reports show that social media gains 840 new users each minute . Since 2013, the number of Tweets each minute has increased 58% to more than 455,000 Tweets PER MINUTE in 2017 ! Youtube usage more than tripled from 2014-2016 with users uploading 400 hours of new video each minute of every day! Now, in 2017, users are watching 4,146,600 videos every minute. Instagram users upload 46,740 million posts every minute! Since 2013, the number of Facebook Posts shared each minute has increased 22%, from 2.5 Million to 3 million posts per minute in 2016. This number has increased more than 300 percent, from around 650,000 posts per minute in 2011! Every minute on Facebook: 510,000 comments are posted, 293,000 statuses are updated, and 136,000 photos are uploaded. Facebook users also click the like button on more than 4 million posts every minute ! 3,607,080 Google searches are conducted worldw