title
stringlengths
3
221
text
stringlengths
17
477k
parsed
listlengths
0
3.17k
Count the number of rows and columns in given Matrix having all primes
28 Jan, 2022 Given a 2D matrix arr[] of size N*M, the task is to find the number of rows and columns having all primes. Examples: Input: arr[]= { { 2, 5, 7 }, { 3, 10, 4 }, { 11, 13, 17 } };Output: 3Explanation: 2 Rows: {2, 5, 7}, {11, 13, 17}1 Column: {2, 3, 11} Input: arr[]={ { 1, 4 }, { 4, 6 } }Output: 0 Approach: F...
[ { "code": null, "e": 28, "s": 0, "text": "\n28 Jan, 2022" }, { "code": null, "e": 135, "s": 28, "text": "Given a 2D matrix arr[] of size N*M, the task is to find the number of rows and columns having all primes." }, { "code": null, "e": 145, "s": 135, "text": ...
What is Syslog server and its working ?
20 Oct, 2021 All network devices such as routers, servers, firewalls, etc. create or prompt logs about statuses and the events that occur. For a small system tracking these logs is not a problem, the problem arises when we are dealing with big systems where tracking all these logs and information becomes challenging. T...
[ { "code": null, "e": 28, "s": 0, "text": "\n20 Oct, 2021" }, { "code": null, "e": 489, "s": 28, "text": "All network devices such as routers, servers, firewalls, etc. create or prompt logs about statuses and the events that occur. For a small system tracking these logs is not a p...
Python | sympy.div() method
26 Aug, 2019 Syntax:sympy.div(f, g, domain='QQ') Return: division of polynomials with remainder Example #1: # import sympy from sympy import * f = 5 * x**2 + 10 * x + 3g = 2 * x + 2 # Using sympy.div() method q, r = div(f, g, domain ='QQ') print(q)print(r) Output: 5*x/2 + 5/2 -2 Example #2: # import sympy from sy...
[ { "code": null, "e": 28, "s": 0, "text": "\n26 Aug, 2019" }, { "code": null, "e": 112, "s": 28, "text": "Syntax:sympy.div(f, g, domain='QQ')\nReturn: division of polynomials with remainder\n" }, { "code": null, "e": 124, "s": 112, "text": "Example #1:" }, ...
ReactJS getSnapshotBeforeUpdate() Method
23 Dec, 2020 The getSnapshotBeforeUpdate() method is invoked just before the DOM is being rendered. It is used to store the previous values of the state after the DOM is updated. Any value returned by getSnapshotBeforeUpdate() method will be used as a parameter for componentDidUpdate() method. This function is always u...
[ { "code": null, "e": 28, "s": 0, "text": "\n23 Dec, 2020" }, { "code": null, "e": 194, "s": 28, "text": "The getSnapshotBeforeUpdate() method is invoked just before the DOM is being rendered. It is used to store the previous values of the state after the DOM is updated." }, {...
Node having maximum sum of immediate children and itself in n-ary tree
28 Jun, 2021 Given an N-Ary tree, find and return the node for which sum of data of all children and the node itself is maximum. In the sum, data of node itself and data of its immediate children is to be taken. For example in the given tree, maxSum Node = 4 with maximum sum of 28 Chapters descriptions off, select...
[ { "code": null, "e": 54, "s": 26, "text": "\n28 Jun, 2021" }, { "code": null, "e": 285, "s": 54, "text": "Given an N-Ary tree, find and return the node for which sum of data of all children and the node itself is maximum. In the sum, data of node itself and data of its immediate ...
Set background image as fixed with CSS
Use the background-attachment property to display the background image as fixed. You can try to run the following code to implement the background-attachment property − Live Demo <!DOCTYPE html> <html> <head> <style> body { background-image: url("https://www.tutorialspoint.com/videotutoria...
[ { "code": null, "e": 1268, "s": 1187, "text": "Use the background-attachment property to display the background image as fixed." }, { "code": null, "e": 1356, "s": 1268, "text": "You can try to run the following code to implement the background-attachment property −" }, { ...
How to make an svg scale with its parent container ?
03 Nov, 2020 SVG is the abbreviation for Scalable Vector Graphics. It is an Extensible Markup Language (XML) based vector image format for two-dimensional graphics. It supports interactivity and animation. This means that every attribute and every element present in the SVG file can be animated. SVG image behaviors are...
[ { "code": null, "e": 28, "s": 0, "text": "\n03 Nov, 2020" }, { "code": null, "e": 566, "s": 28, "text": "SVG is the abbreviation for Scalable Vector Graphics. It is an Extensible Markup Language (XML) based vector image format for two-dimensional graphics. It supports interactivi...
Print a long int in C using putchar() only
21 Jun, 2022 Write a C function print(n) that takes a long int number n as argument, and prints it on console. The only allowed library function is putchar(), no other function like itoa() or printf() is allowed. Use of loops is also not allowed. We strongly recommend to minimize the browser and try this yourself first...
[ { "code": null, "e": 52, "s": 24, "text": "\n21 Jun, 2022" }, { "code": null, "e": 286, "s": 52, "text": "Write a C function print(n) that takes a long int number n as argument, and prints it on console. The only allowed library function is putchar(), no other function like itoa(...
ReactJS UI Ant Design Modal Component
18 Jan, 2022 Ant Design Library has this component pre-built, and it is very easy to integrate as well. Modal Component provides a solid foundation for creating dialogs, lightboxes, popovers, etc. It is used to display Modal dialogs. We can use the following approach in ReactJS to use the Ant Design Modal Component. Mo...
[ { "code": null, "e": 28, "s": 0, "text": "\n18 Jan, 2022" }, { "code": null, "e": 333, "s": 28, "text": "Ant Design Library has this component pre-built, and it is very easy to integrate as well. Modal Component provides a solid foundation for creating dialogs, lightboxes, popove...
How to schedule a thread for execution in C#
01 Feb, 2019 Thread.Start Method is responsible for a thread to be scheduled for execution. This method can be overloaded by passing different parameters to it. Start() Start(Object) This method tells the operating system to change the state of the current instance to Running. Or in other words, due to this method the ...
[ { "code": null, "e": 28, "s": 0, "text": "\n01 Feb, 2019" }, { "code": null, "e": 176, "s": 28, "text": "Thread.Start Method is responsible for a thread to be scheduled for execution. This method can be overloaded by passing different parameters to it." }, { "code": null,...
How to make a NumPy array read-only?
17 Jun, 2022 Let’s discuss how to make NumPy array immutable i.e that can not be rewritten or can’t be changed. This can be done by setting a writable flag of the NumPy array to false. Syntax: array.flags.writable=False This set the writable flag to false and hence array becomes immutable i.e read-only. See the exampl...
[ { "code": null, "e": 28, "s": 0, "text": "\n17 Jun, 2022" }, { "code": null, "e": 200, "s": 28, "text": "Let’s discuss how to make NumPy array immutable i.e that can not be rewritten or can’t be changed. This can be done by setting a writable flag of the NumPy array to false." ...
Dynamic Programming on Trees | Set-1
20 Oct, 2021 Dynamic Programming(DP) is a technique to solve problems by breaking them down into overlapping sub-problems which follows the optimal substructure. There are various problems using DP like subset sum, knapsack, coin change etc. DP can also be applied on trees to solve some specific problems.Pre-requisite:...
[ { "code": null, "e": 54, "s": 26, "text": "\n20 Oct, 2021" }, { "code": null, "e": 514, "s": 54, "text": "Dynamic Programming(DP) is a technique to solve problems by breaking them down into overlapping sub-problems which follows the optimal substructure. There are various problem...
Largest divisible subset in array
08 Jul, 2022 Given an array the task is to largest divisible subset in array. A subset is called divisible if for every pair (x, y) in subset, either x divides y or y divides x. Examples: Input : arr[] = {1, 16, 7, 8, 4} Output : 16 8 4 1 In the output subset, for every pair, either the first element divides second o...
[ { "code": null, "e": 52, "s": 24, "text": "\n08 Jul, 2022" }, { "code": null, "e": 217, "s": 52, "text": "Given an array the task is to largest divisible subset in array. A subset is called divisible if for every pair (x, y) in subset, either x divides y or y divides x." }, {...
What is the difference between the widgets of tkinter and tkinter.ttk in Python?
tkinter.ttk is a module that is used to style the tkinter widgets. Just like CSS is used to style an HTML element, we use tkinter.ttk to style tkinter widgets. Here are the major differences between tkinter widget and tkinter.ttk − Tkinter widgets are used to add Buttons, Labels, Text, ScrollBar, etc., however, tkinter...
[ { "code": null, "e": 1347, "s": 1187, "text": "tkinter.ttk is a module that is used to style the tkinter widgets. Just like CSS is used to style an HTML element, we use tkinter.ttk to style tkinter widgets." }, { "code": null, "e": 1419, "s": 1347, "text": "Here are the major dif...
How do we use multi-line comments in JavaScript?
The following is a multi line comment in JavaScript. /* * This is a multiline comment in JavaScript * It is very similar to comments in C Programming */ The following example shows how to use multi-line comments in JavaScript. <script> <!-- /* * This is a multiline comment in JavaScript ...
[ { "code": null, "e": 1240, "s": 1187, "text": "The following is a multi line comment in JavaScript." }, { "code": null, "e": 1346, "s": 1240, "text": "/*\n * This is a multiline comment in JavaScript\n * It is very similar to comments in C Programming\n*/" }, { "code"...
Python Program to swap two numbers without using third variable
16 Nov, 2020 Given two variables n1 and n2. The task is to swap the values of both the variables without using third variable.Examples: X : 10 Y : 20 After swapping X and Y, we get : X : 20 Y : 10 A : 'Hello' B : 'World' After swapping A and B, we get : A : 'World' B : 'Hello' Method 1 :- Usin...
[ { "code": null, "e": 52, "s": 24, "text": "\n16 Nov, 2020" }, { "code": null, "e": 177, "s": 52, "text": "Given two variables n1 and n2. The task is to swap the values of both the variables without using third variable.Examples: " }, { "code": null, "e": 244, "s"...
Python Text To Speech | pyttsx module
14 Jan, 2019 pyttsx is a cross-platform text to speech library which is platform independent. The major advantage of using this library for text-to-speech conversion is that it works offline. However, pyttsx supports only Python 2.x. Hence, we will see pyttsx3 which is modified to work on both Python 2.x and Python 3.x...
[ { "code": null, "e": 52, "s": 24, "text": "\n14 Jan, 2019" }, { "code": null, "e": 380, "s": 52, "text": "pyttsx is a cross-platform text to speech library which is platform independent. The major advantage of using this library for text-to-speech conversion is that it works offl...
Python Program for Largest K digit number divisible by X
03 Dec, 2018 Integers X and K are given. The task is to find highest K-digit number divisible by X. Examples: Input : X = 30, K = 3 Output : 990 990 is the largest three digit number divisible by 30. Input : X = 7, K = 2 Output : 98 An efficient solution is to use below formula. ans = MAX - (MAX % X) where MAX is th...
[ { "code": null, "e": 28, "s": 0, "text": "\n03 Dec, 2018" }, { "code": null, "e": 115, "s": 28, "text": "Integers X and K are given. The task is to find highest K-digit number divisible by X." }, { "code": null, "e": 125, "s": 115, "text": "Examples:" }, {...
Change Data Type for one or more columns in Pandas Dataframe
08 Jul, 2022 Let’s see How To Change Column Type in Pandas DataFrames, There are different ways of changing DataType for one or more columns in Pandas Dataframe. DataFrame.astype() method is used to cast pandas object to a specified dtype. This function also provides the capability to convert any suitable existing colu...
[ { "code": null, "e": 28, "s": 0, "text": "\n08 Jul, 2022" }, { "code": null, "e": 177, "s": 28, "text": "Let’s see How To Change Column Type in Pandas DataFrames, There are different ways of changing DataType for one or more columns in Pandas Dataframe." }, { "code": null...
Introduction to Apache Maven | A build automation tool for Java projects
29 Jun, 2022 Maven is a powerful project management tool that is based on POM (project object model). It is used for projects build, dependency and documentation. It simplifies the build process like ANT. But it is too much advanced than ANT.In short terms we can tell maven is a tool that can be used for building and m...
[ { "code": null, "e": 52, "s": 24, "text": "\n29 Jun, 2022" }, { "code": null, "e": 517, "s": 52, "text": "Maven is a powerful project management tool that is based on POM (project object model). It is used for projects build, dependency and documentation. It simplifies the build ...
pandas.eval() function in Python
14 Aug, 2020 This method is used to evaluate a Python expression as a string using various back ends. It returns ndarray, numeric scalar, DataFrame, Series. Syntax : pandas.eval(expr, parser=’pandas’, engine=None, truediv=True, local_dict=None, global_dict=None, resolvers=(), level=0, target=None, inplace=False) Argume...
[ { "code": null, "e": 28, "s": 0, "text": "\n14 Aug, 2020" }, { "code": null, "e": 172, "s": 28, "text": "This method is used to evaluate a Python expression as a string using various back ends. It returns ndarray, numeric scalar, DataFrame, Series." }, { "code": null, ...
Nagarro Interview Experience for Women Pool Campus Drive 2021 - GeeksforGeeks
09 Mar, 2021 I participated in Nagarro’s pool campus drive only for women in February 2021. It was a tremendous experience I got from some series of coding tests and interviews. Nagarro is one of the leading industries of today’s era. It is a CMMI level 5 company that focuses more on growth and innovation. The drive co...
[ { "code": null, "e": 26409, "s": 26381, "text": "\n09 Mar, 2021" }, { "code": null, "e": 26704, "s": 26409, "text": "I participated in Nagarro’s pool campus drive only for women in February 2021. It was a tremendous experience I got from some series of coding tests and interviews...
Delete all even elements from a stack - GeeksforGeeks
18 Aug, 2021 Given a stack with n elements, the task is to remove all the elements of the stack without affecting the order of elements.Examples: Input : s = 16 <- 15 <- 29 <- 24 <- 19 (TOP) Output: 19 29 15 19 29 15 is the order of odd elements in which they will be popped from the given stack.Input : s = 1 <- 2 <- ...
[ { "code": null, "e": 26297, "s": 26269, "text": "\n18 Aug, 2021" }, { "code": null, "e": 26432, "s": 26297, "text": "Given a stack with n elements, the task is to remove all the elements of the stack without affecting the order of elements.Examples: " }, { "code": null, ...
Python Closures - GeeksforGeeks
27 Jan, 2022 Before seeing what a closure is, we have to first understand what nested functions and non-local variables are. A function that is defined inside another function is known as a nested function. Nested functions are able to access variables of the enclosing scope. In Python, these non-local variables can ...
[ { "code": null, "e": 42677, "s": 42649, "text": "\n27 Jan, 2022" }, { "code": null, "e": 42791, "s": 42677, "text": "Before seeing what a closure is, we have to first understand what nested functions and non-local variables are. " }, { "code": null, "e": 43100, "...
How to append a new table row in AngularJS ? - GeeksforGeeks
15 Oct, 2020 Here the task is to insert a new row in the table with the help of AngularJS. Approach: The approach is to use the push() method to insert the new rows into the array. This array will be served as the content to the <tr> element. The ng-repeat is used to serve the content of the array to the table cells. E...
[ { "code": null, "e": 25666, "s": 25638, "text": "\n15 Oct, 2020" }, { "code": null, "e": 25744, "s": 25666, "text": "Here the task is to insert a new row in the table with the help of AngularJS." }, { "code": null, "e": 25972, "s": 25744, "text": "Approach: Th...
How to declare object with computed property name in JavaScript ? - GeeksforGeeks
22 Nov, 2021 In this article, we learn how to declare an object with a computed property name. Before beginning this article, we have to know about the javascript objects. Javascript Object: Javascript objects contain key-value pairs in which the key represents a property from which we can get and set the value of the ...
[ { "code": null, "e": 26545, "s": 26517, "text": "\n22 Nov, 2021" }, { "code": null, "e": 26704, "s": 26545, "text": "In this article, we learn how to declare an object with a computed property name. Before beginning this article, we have to know about the javascript objects." }...
Select Statement in Go Language - GeeksforGeeks
20 Nov, 2019 In Go language, the select statement is just like switch statement, but in the select statement, case statement refers to communication, i.e. sent or receive operation on the channel. Syntax: select{ case SendOrReceive1: // Statement case SendOrReceive2: // Statement case SendOrReceive3: // Statement .......
[ { "code": null, "e": 26151, "s": 26123, "text": "\n20 Nov, 2019" }, { "code": null, "e": 26335, "s": 26151, "text": "In Go language, the select statement is just like switch statement, but in the select statement, case statement refers to communication, i.e. sent or receive opera...
std::basic_istream::ignore in C++ with Examples - GeeksforGeeks
10 Jan, 2022 The std::basic_istream::ignore is used to extracts characters from the input string and discards them including delimiting character, i.e., if the end of the file is reached this function stops extracting characters. The delimiting character is the new line character i.e ‘\n’. This function will also stop ...
[ { "code": null, "e": 25343, "s": 25315, "text": "\n10 Jan, 2022" }, { "code": null, "e": 25945, "s": 25343, "text": "The std::basic_istream::ignore is used to extracts characters from the input string and discards them including delimiting character, i.e., if the end of the file ...
How to destroy a button in jQuery UI ? - GeeksforGeeks
31 Dec, 2020 To destroy a button in jQuery UI we will be using destroy() method which is discussed below: jQuery UI destroy() Method is used to remove the complete functionality of the button. It returns the button element completely to its initial state. Syntax: $(".selector").button("destroy") Parameters: This method...
[ { "code": null, "e": 26392, "s": 26364, "text": "\n31 Dec, 2020" }, { "code": null, "e": 26485, "s": 26392, "text": "To destroy a button in jQuery UI we will be using destroy() method which is discussed below:" }, { "code": null, "e": 26635, "s": 26485, "text"...
Secondary Indexes on MAP Collection in Cassandra - GeeksforGeeks
17 Mar, 2021 In this article, we will discuss the overview of Secondary Indexes on MAP Collection in Cassandra and then will implement the exercise and will see how it actually works, and then finally will conclude the importance of Secondary Indexes on MAP Collection. Let’s discuss it one by one. Pre-requisite – Conce...
[ { "code": null, "e": 25641, "s": 25613, "text": "\n17 Mar, 2021" }, { "code": null, "e": 25927, "s": 25641, "text": "In this article, we will discuss the overview of Secondary Indexes on MAP Collection in Cassandra and then will implement the exercise and will see how it actually...
calloc() versus malloc() in C
The function calloc() stands for contiguous location. It works similar to the malloc() but it allocate the multiple blocks of memory each of same size. Here is the syntax of calloc() in C language, void *calloc(size_t number, size_t size); Here, number − The number of elements of array to be allocated. size − Size of a...
[ { "code": null, "e": 1214, "s": 1062, "text": "The function calloc() stands for contiguous location. It works similar to the malloc() but it allocate the multiple blocks of memory each of same size." }, { "code": null, "e": 1260, "s": 1214, "text": "Here is the syntax of calloc()...
Check if two List objects are equal in C#
To check if two List objects are equal, the code is as follows − Live Demo using System; using System.Collections.Generic; public class Demo { public static void Main(String[] args){ List<string> list1 = new List<string>(); list1.Add("One"); list1.Add("Two"); list1.Add("Three"); list1....
[ { "code": null, "e": 1127, "s": 1062, "text": "To check if two List objects are equal, the code is as follows −" }, { "code": null, "e": 1138, "s": 1127, "text": " Live Demo" }, { "code": null, "e": 1962, "s": 1138, "text": "using System;\nusing System.Collect...
Basic Time Series Analysis and Trading Strategy with Bitcoin Price Data | by Ricky Kim | Towards Data Science
Time series analysis is not an easy topic I must say. At least for me. During my class in General Assembly London’s Data Science Immersive course, I had a chance to learn the topic, and it took me some time to get my head around it. The purpose of this post is to reinforce what I have learned by implementing and trying...
[ { "code": null, "e": 405, "s": 172, "text": "Time series analysis is not an easy topic I must say. At least for me. During my class in General Assembly London’s Data Science Immersive course, I had a chance to learn the topic, and it took me some time to get my head around it." }, { "code": ...
Java 8 - New Date/Time API
With Java 8, a new Date-Time API is introduced to cover the following drawbacks of old date-time API. Not thread safe − java.util.Date is not thread safe, thus developers have to deal with concurrency issue while using date. The new date-time API is immutable and does not have setter methods. Not thread safe − java.uti...
[ { "code": null, "e": 1976, "s": 1874, "text": "With Java 8, a new Date-Time API is introduced to cover the following drawbacks of old date-time API." }, { "code": null, "e": 2168, "s": 1976, "text": "Not thread safe − java.util.Date is not thread safe, thus developers have to dea...
Ints join() function in Java
The join() method of Ints class returns a string containing the supplied int values separated by separator. The syntax is as follows − public static String join(String separator, int[] arr) Here, separator parameter is something that should appear between consecutive values, whereas arr is an array of int values. Le...
[ { "code": null, "e": 1197, "s": 1062, "text": "The join() method of Ints class returns a string containing the supplied int values separated by separator. The syntax is as follows −" }, { "code": null, "e": 1255, "s": 1197, "text": "public static String\n join(String separator,...
How do I declare global variables on Android using Kotlin?
This example demonstrates how to declare global variables on Android using Kotlin. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. <?xml version="1.0" encoding="utf-8"?> <Rel...
[ { "code": null, "e": 1145, "s": 1062, "text": "This example demonstrates how to declare global variables on Android using Kotlin." }, { "code": null, "e": 1274, "s": 1145, "text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required det...
Python - Working with .docx module
Word documents contain formatted text wrapped within three object levels. Lowest level- Run objects, Middle level- Paragraph objects and Highest level- Document object. So, we cannot work with these documents using normal text editors. But we can manipulate these word documents in python using the python-docx module. T...
[ { "code": null, "e": 1231, "s": 1062, "text": "Word documents contain formatted text wrapped within three object levels. Lowest level- Run objects, Middle level- Paragraph objects and Highest level- Document object." }, { "code": null, "e": 1381, "s": 1231, "text": "So, we cannot...
JavaScript Function Call
The JavaScript call() function allows us to use the same method from different objects. The parameters are passed separately here. Following is the code for the JavaScript function call() − Live Demo <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, ini...
[ { "code": null, "e": 1193, "s": 1062, "text": "The JavaScript call() function allows us to use the same method from different objects. The parameters are passed separately here." }, { "code": null, "e": 1252, "s": 1193, "text": "Following is the code for the JavaScript function c...
Tryit Editor v3.6 - Show React
import React from 'react'; import ReactDOM from 'react-dom/client'; const myFirstElement = <h1>Hello React!</h1> const root = ReactDOM.createRoot(document.getElementById('root')); root.render(myFirstElement); /* You are now watching the React file 'index.js' through our 'Show React' tool. */ <!DOCTYPE html> <htm...
[ { "code": null, "e": 299, "s": 0, "text": "\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\n\nconst myFirstElement = <h1>Hello React!</h1>\n\nconst root = ReactDOM.createRoot(document.getElementById('root'));\nroot.render(myFirstElement);\n\n/*\nYou are now watching\nthe React...
How to display long X-axis labels in a bar chart using plotly in R?
Plotly in R is a package specifically designed to create highly-interactive and publication-quality charts. The chart can be created by using plot_ly function of the package and there are three main arguments of plot_ly defined as x, y, and type, where x refers to the X-axis, y refers to the Y-axis and type refers to t...
[ { "code": null, "e": 1463, "s": 1062, "text": "Plotly in R is a package specifically designed to create highly-interactive and publication-quality charts. The chart can be created by using plot_ly function of the package and there are three main arguments of plot_ly defined as x, y, and type, where ...
How to show alert dialog in Android?
This example demonstrates how do I show alert dialog in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xml...
[ { "code": null, "e": 1127, "s": 1062, "text": "This example demonstrates how do I show alert dialog in android." }, { "code": null, "e": 1256, "s": 1127, "text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a n...
StringBuilder setLength() in Java with Examples - GeeksforGeeks
30 Jul, 2019 The setLength(int newLength) method of StringBuilder is used to set the length of the character sequence equal to newLength.For every index k greater then 0 and less than newLength. If the newLength passed as argument is less than the old length, the old length is changed to the newLength.If the newLength ...
[ { "code": null, "e": 23557, "s": 23529, "text": "\n30 Jul, 2019" }, { "code": null, "e": 24041, "s": 23557, "text": "The setLength(int newLength) method of StringBuilder is used to set the length of the character sequence equal to newLength.For every index k greater then 0 and le...
How can I create a table with borders in Android?
This example demonstrates how create a table with borders in Android . Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. <?xml version="1.0" encoding="utf-8"?> <TableLayout x...
[ { "code": null, "e": 1133, "s": 1062, "text": "This example demonstrates how create a table with borders in Android ." }, { "code": null, "e": 1263, "s": 1133, "text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to cre...
Get the sum of a column in all MySQL rows?
Use aggregate function SUM() to get the sum of a column in al rows. Let us first create a table − mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Amount int ); Query OK, 0 rows affected (0.20 sec) Insert some records in the table using insert command − mysql> insert into DemoTable(A...
[ { "code": null, "e": 1160, "s": 1062, "text": "Use aggregate function SUM() to get the sum of a column in al rows. Let us first create a table −" }, { "code": null, "e": 1296, "s": 1160, "text": "mysql> create table DemoTable\n (\n Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, ...
Absolute Difference of 1 | Practice | GeeksforGeeks
Given an array arr of size n. Print all the numbers less than kandshould be such that the difference between every adjacent digit should be 1in the array. Note: Return empty list if no such number present, driver code will automatically print -1. Example 1: Input:n = 8, k = 54arr[] = {7, 98, 56, 43, 45, 23, 12, 8}Outpu...
[ { "code": null, "e": 381, "s": 226, "text": "Given an array arr of size n. Print all the numbers less than kandshould be such that the difference between every adjacent digit should be 1in the array." }, { "code": null, "e": 473, "s": 381, "text": "Note: Return empty list if no s...
Ensemble Models. A guide to learning ensemble techniques... | by Mohammed Alhamid | Towards Data Science
In our life, at the time of making an essential decision like applying for a university program, signing a job contract, we tend to seek a piece of advice. We try to collect as much information as possible and reach out to multiple experts. Since such decisions could impact our future, we trust more the decision that h...
[ { "code": null, "e": 728, "s": 172, "text": "In our life, at the time of making an essential decision like applying for a university program, signing a job contract, we tend to seek a piece of advice. We try to collect as much information as possible and reach out to multiple experts. Since such dec...
Bootstrap Inline Form
To create a form where all of the elements are inline, left aligned and labels are alongside, add the class .form-inline to the <form> tag. You can try to run the following code to create an inline form in Bootstrap − Live Demo <!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <meta name = "...
[ { "code": null, "e": 1202, "s": 1062, "text": "To create a form where all of the elements are inline, left aligned and labels are alongside, add the class .form-inline to the <form> tag." }, { "code": null, "e": 1280, "s": 1202, "text": "You can try to run the following code to c...
Angular PrimeNG TimeLine Component - GeeksforGeeks
03 Oct, 2021 Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the TimeLine Component in Angular PrimeNG. We will also learn abou...
[ { "code": null, "e": 26422, "s": 26394, "text": "\n03 Oct, 2021" }, { "code": null, "e": 26622, "s": 26422, "text": "Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make resp...
Add elements to a linked list using Javascript
We need to create a function insert(data, position) that inserts data at given position in the linked list. We'll perform the following steps − Create a new Node Check if the list is empty. If it then adds the node to head and return. If not, then we'll iterate to the position we want to insert it to using currElem. We...
[ { "code": null, "e": 1206, "s": 1062, "text": "We need to create a function insert(data, position) that inserts data at given position in the linked list. We'll perform the following steps −" }, { "code": null, "e": 1224, "s": 1206, "text": "Create a new Node" }, { "code"...
How to Show and hide a View with a slide up/down animation in android?
This example demonstrate about how to Show and hide a View with a slide up/down animation in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. <?xml version = "1.0" en...
[ { "code": null, "e": 1164, "s": 1062, "text": "This example demonstrate about how to Show and hide a View with a slide up/down animation in android." }, { "code": null, "e": 1293, "s": 1164, "text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fi...
SQLSERVER Tryit Editor v1.0
SELECT ISNUMERIC('Hello world!'); ​ Edit the SQL Statement, and click "Run SQL" to see the result. This SQL-Statement is not supported in the WebSQL Database. The example still works, because it uses a modified version of SQL. Your browser does not support WebSQL. Your are now using a light-version of the Try-...
[ { "code": null, "e": 34, "s": 0, "text": "SELECT ISNUMERIC('Hello world!');" }, { "code": null, "e": 36, "s": 34, "text": "​" }, { "code": null, "e": 108, "s": 45, "text": "Edit the SQL Statement, and click \"Run SQL\" to see the result." }, { "code": ...
Create a button look like a link with Bootstrap
Use the .btn-link class in Bootstrap to create a button look like a link. You can try to run the following code to implement a .btn-link class Live Demo <!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1...
[ { "code": null, "e": 1136, "s": 1062, "text": "Use the .btn-link class in Bootstrap to create a button look like a link." }, { "code": null, "e": 1205, "s": 1136, "text": "You can try to run the following code to implement a .btn-link class" }, { "code": null, "e": 12...
Array element with minimum sum of absolute differences in C++?
This program is to find minimum absolute difference of the array given we have an array which have distinct element.To learn this concept better let’s rebrush the things that required, Array is a container of elements of same data type. The length of an array needs to be predefined. absolute difference is the absolute ...
[ { "code": null, "e": 1247, "s": 1062, "text": "This program is to find minimum absolute difference of the array given we have an array which have distinct element.To learn this concept better let’s rebrush the things that required," }, { "code": null, "e": 1346, "s": 1247, "text"...
C# Program to Show the Use of GetEnvironmentVariable() Method of Environment Class - GeeksforGeeks
16 Nov, 2021 In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operating system-related information. We can use it in such a way that it retrieves command-line arguments information, exit codes information, enviro...
[ { "code": null, "e": 23911, "s": 23883, "text": "\n16 Nov, 2021" }, { "code": null, "e": 24619, "s": 23911, "text": "In C#, Environment Class provides information about the current platform and manipulates, the current platform. It is useful for getting and setting various operat...
Exploratory Data Analysis and Data Cleaning Practical Workout | by Mugdha D | Towards Data Science
Exploratory data analysis (EDA) is a vital part of data science as it helps to discover relationships between the entities of the data we are working on. It is helpful to use EDA when we’re dealing with data for the first time. It also helps with large datasets as it is not practically possible to determine relationshi...
[ { "code": null, "e": 638, "s": 172, "text": "Exploratory data analysis (EDA) is a vital part of data science as it helps to discover relationships between the entities of the data we are working on. It is helpful to use EDA when we’re dealing with data for the first time. It also helps with large da...
How to hide soft KeyBoard on android after clicking outside edittext?
This example demonstrates how do I hide soft keyboard on android after clicking outside edittext. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml. <?xml version="1.0" encoding...
[ { "code": null, "e": 1160, "s": 1062, "text": "This example demonstrates how do I hide soft keyboard on android after clicking outside edittext." }, { "code": null, "e": 1289, "s": 1160, "text": "Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill a...
Can we write any statements between try, catch and finally blocks in Java?
No, we cannot write any statements in between try, catch and finally blocks and these blocks form one unit. The functionality of try keyword is to identify an exception object and catch that exception object and transfer the control along with the identified exception object to the catch block by suspending the execut...
[ { "code": null, "e": 1782, "s": 1062, "text": "No, we cannot write any statements in between try, catch and finally blocks and these blocks form one unit. The functionality of try keyword is to identify an exception object and catch that exception object and transfer the control along with the iden...
What is the difference between jQuery.load() and jQuery.get() methods in jQuery?
The load( url, data, callback ) method loads data from the server and places the returned HTML into the matched element. Here is the description of all the parameters used by this method − url − A string containing the URL to which the request is sent. data − This optional parameter represents a map of data that is sen...
[ { "code": null, "e": 1183, "s": 1062, "text": "The load( url, data, callback ) method loads data from the server and places the returned HTML into the matched element." }, { "code": null, "e": 1251, "s": 1183, "text": "Here is the description of all the parameters used by this me...
The Approximation Power of Neural Networks (with Python codes) | by Marco Tavora Ph.D. | Towards Data Science
It is a well-known fact that neural networks can approximate the output of any continuous mathematical function, no matter how complicated it might be. Take for instance the function below: Though it has a pretty complicated shape, the theorems we will discuss shortly guarantee that one can build some neural network th...
[ { "code": null, "e": 361, "s": 171, "text": "It is a well-known fact that neural networks can approximate the output of any continuous mathematical function, no matter how complicated it might be. Take for instance the function below:" }, { "code": null, "e": 607, "s": 361, "text...
MapStruct - Mapping Multiple Objects
We can add map multiple objects as well. For Example, we want to get a DeliveryAddress Object using Student and Address object. Now create a mapper interface which can map two objects into one. @Mapper public interface DeliveryAddressMapper { @Mapping(source = "student.name", target = "name") @Mapping(source = "a...
[ { "code": null, "e": 2388, "s": 2260, "text": "We can add map multiple objects as well. For Example, we want to get a DeliveryAddress Object using Student and Address object." }, { "code": null, "e": 2454, "s": 2388, "text": "Now create a mapper interface which can map two object...
Anchor Pseudo-classes in CSS
Using CSS pseudo-class selectors, namely, :active, :hover, :link and :visited we can style different states of a link/anchor. For proper functionality, the order of these selectors should be − :link :visited :hover :active The syntax of CSS psudo-class property is as follows − a:(pseudo-selector) { /*declarations*/ ...
[ { "code": null, "e": 1255, "s": 1062, "text": "Using CSS pseudo-class selectors, namely, :active, :hover, :link and :visited we can style different states of a link/anchor. For proper functionality, the order of these selectors should be −" }, { "code": null, "e": 1261, "s": 1255, ...
Rust - Array
In this chapter, we will learn about an array and the various features associated with it. Before we learn about arrays, let us see how an array is different from a variable. Variables have the following limitations − Variables are scalar in nature. In other words, a variable declaration can only contain a single value...
[ { "code": null, "e": 2262, "s": 2087, "text": "In this chapter, we will learn about an array and the various features associated with it. Before we learn about arrays, let us see how an array is different from a variable." }, { "code": null, "e": 2305, "s": 2262, "text": "Variabl...
Program to find out the k-th smallest difference between all element pairs in an array in C++
Suppose we are given a list containing several integer numbers. We have to find out the difference between each pair of values in the array and find out the k-th smallest difference number. The index starts at 0 and the value k is given to us as input. So, if the input is like numbers = {2, 6, 4, 8}, k = 2, then the ou...
[ { "code": null, "e": 1315, "s": 1062, "text": "Suppose we are given a list containing several integer numbers. We have to find out the difference between each pair of values in the array and find out the k-th smallest difference number. The index starts at 0 and the value k is given to us as input."...
A Space Optimized DP solution for 0-1 Knapsack Problem
23 May, 2022 Given the weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays val[0..n-1] and wt[0..n-1] which represent values and weights associated with n items respectively. Also given an integer W which rep...
[ { "code": null, "e": 52, "s": 24, "text": "\n23 May, 2022" }, { "code": null, "e": 623, "s": 52, "text": "Given the weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. In other words, given two integer arrays ...
TensorFlow - Multi-Layer Perceptron Learning
Multi-Layer perceptron defines the most complicated architecture of artificial neural networks. It is substantially formed from multiple layers of perceptron. The diagrammatic representation of multi-layer perceptron learning is as shown below − MLP networks are usually used for supervised learning format. A typical le...
[ { "code": null, "e": 2608, "s": 2449, "text": "Multi-Layer perceptron defines the most complicated architecture of artificial neural networks. It is substantially formed from multiple layers of perceptron." }, { "code": null, "e": 2695, "s": 2608, "text": "The diagrammatic repres...
MySQL - ABS() Function
MySQL provides a set of functions to perform various numerical functions. The ABS() function of MySQL accepts an integer value as a parameter and returns the absolute value for the given integer. Following is the syntax of this function − ABS(x) Where x is a real number. Following is an example of the MySQL ABS() func...
[ { "code": null, "e": 2637, "s": 2441, "text": "MySQL provides a set of functions to perform various numerical functions. The ABS() function of MySQL accepts an integer value as a parameter and returns the absolute value for the given integer." }, { "code": null, "e": 2680, "s": 2637,...
Import module in Python
12 May, 2021 Import in python is similar to #include header_file in C/C++. Python modules can get access to code from another module by importing the file/function using import. The import statement is the most common way of invoking the import machinery, but it is not the only way. import module_name When the import i...
[ { "code": null, "e": 52, "s": 24, "text": "\n12 May, 2021" }, { "code": null, "e": 323, "s": 52, "text": "Import in python is similar to #include header_file in C/C++. Python modules can get access to code from another module by importing the file/function using import. The impor...
turtle.end_fill() function in Python
29 Jun, 2021 The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. This method is used to Fill the shape drawn after the call begin_fill(). It doesn’t take a...
[ { "code": null, "e": 28, "s": 0, "text": "\n29 Jun, 2021" }, { "code": null, "e": 245, "s": 28, "text": "The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a ver...
Why Abstract Class is used in Java?
A class is an abstract class if it contains at least one abstract method. It can contain other non-abstract methods as well. A class can be declared as abstract by using the abstract keyword. Also, an abstract class cannot be instantiated. A program that demonstrates an abstract class in Java is given as follows: Live...
[ { "code": null, "e": 1427, "s": 1187, "text": "A class is an abstract class if it contains at least one abstract method. It can contain other non-abstract methods as well. A class can be declared as abstract by using the abstract keyword. Also, an abstract class cannot be instantiated." }, { ...
How to convert NumPy datetime64 to Timestamp?
02 Sep, 2020 In this article, we will discuss how to convert NumPy datetime64 to Timestamp. For better understanding first, let’s see the below example: If the current datetime64 is as follows: 2020-08-18 09:31:51.944622 then, the required timestamp in seconds will be: 1597743111.944622 the required timestamp in minut...
[ { "code": null, "e": 28, "s": 0, "text": "\n02 Sep, 2020" }, { "code": null, "e": 169, "s": 28, "text": "In this article, we will discuss how to convert NumPy datetime64 to Timestamp. For better understanding first, let’s see the below example: " }, { "code": null, "e...
What is the contract between equals() and hashCode() methods in Java?
Every Java object has two very important methods equals() and hashCode() and these methods are designed to be overridden according to their specific general contract. An Object class is the parent class of every class, the default implementation of these two methods is already present in each class. However, we can ove...
[ { "code": null, "e": 1553, "s": 1187, "text": "Every Java object has two very important methods equals() and hashCode() and these methods are designed to be overridden according to their specific general contract. An Object class is the parent class of every class, the default implementation of thes...
Maximum number of edges to be added to a tree so that it stays a Bipartite graph
28 Sep, 2021 A tree is always a Bipartite Graph as we can always break into two disjoint sets with alternate levels. In other words we always color it with two colors such that alternate levels have same color. The task is to compute the maximum no. of edges that can be added to the tree so that it remains Bipartite Gr...
[ { "code": null, "e": 54, "s": 26, "text": "\n28 Sep, 2021" }, { "code": null, "e": 378, "s": 54, "text": "A tree is always a Bipartite Graph as we can always break into two disjoint sets with alternate levels. In other words we always color it with two colors such that alternate ...
Python | Get all substrings of given string
01 Jul, 2019 There are many problems in which we require to get all substrings of a string. This particular utility is very popular in competitive programming and having shorthands to solve this problem can always be handy. Let’s discuss certain ways in which this problem can be solved. Method #1 : Using list comprehen...
[ { "code": null, "e": 54, "s": 26, "text": "\n01 Jul, 2019" }, { "code": null, "e": 329, "s": 54, "text": "There are many problems in which we require to get all substrings of a string. This particular utility is very popular in competitive programming and having shorthands to sol...
Sum of squares of distances between all pairs from given points
24 Nov, 2021 Given an array arr[] consisting of coordinates of N points on an XY-plane, the task is to find the sum of squared distances between all pairs of points, i.e. (Xi – Xj)2 + (Yi – Yj)2 for every distinct pair (i, j). Examples: Input: arr[][] = {{1, 1}, {-1, -1}, {1, -1}, {-1, 1}}Output: 32Explanation: Distanc...
[ { "code": null, "e": 28, "s": 0, "text": "\n24 Nov, 2021" }, { "code": null, "e": 242, "s": 28, "text": "Given an array arr[] consisting of coordinates of N points on an XY-plane, the task is to find the sum of squared distances between all pairs of points, i.e. (Xi – Xj)2 + (Yi ...
Live Search Using Flask And jQuery
09 Apr, 2021 In this article, we will do a live search in Flask using Jquery. Live search means that whenever a user type any letter in the input box then all the words containing that letter will be shown. This module does not come in-built with Python. To install it type the below command in the terminal. pip install...
[ { "code": null, "e": 28, "s": 0, "text": "\n09 Apr, 2021" }, { "code": null, "e": 222, "s": 28, "text": "In this article, we will do a live search in Flask using Jquery. Live search means that whenever a user type any letter in the input box then all the words containing that let...
Java Program to Find Factorial of a Number Recursively
20 Jan, 2022 Factorial of a number n is defined as a product of all positive descending integers, Factorial of n is denoted by n!. Factorial can be calculated using the following recursive formula where the recursive call is made to a multiplicity of all the numbers lesser than the number for which the factorial is com...
[ { "code": null, "e": 28, "s": 0, "text": "\n20 Jan, 2022" }, { "code": null, "e": 394, "s": 28, "text": "Factorial of a number n is defined as a product of all positive descending integers, Factorial of n is denoted by n!. Factorial can be calculated using the following recursive...
Marketing Analytic — Measuring Customer Lifetime Value (CLTV) | by Sarit Maitra | Towards Data Science
ERROR: type should be string, got "https://sarit-maitra.medium.com/membership\nCustomer Life time Value (CLTV) is a quantitative analysis and one of the most important metric to modern customer centric business scenario. It has been a mainstay concept in direct response marketing for many years, and has been increasingly considered in the field of marketing. Here, we will experiment with a implementable CLTV model that is useful for market segmentation and the allocation of marketing resources for acquisition, retention, and cross-selling. The selection of the model is based on a systematic theoretical taxonomy and on assumptions embedded in customer behavior.\nRelevant data is always a basis on any prediction and CLTV is no exception to that. Here are some of the examples / questions we may want to answer:\nHow much money has every particular customer already spend at your shop?\nHow long has every particular customer actually been customer?\nHow old is every particular customer? Age is an important part of customer’s portrait.\nHow did every particular customer respond to the discounts and offers? If we know who is more likely to react, we can formulate strategy and spend the marketing funds exactly on these people, and get a result.\nThe goals of this article lies in the studying of the business problems as mentioned below. I will demonstrate, as how to build a prediction model using Linear Regression for CLTV.\nHow to Identify the most profitable customers?\nHow can a company offer the best and make the most ?\nHow to segment profitable customers?\nHow much budget need to spend to acquire customers?\nThere are few approaches available to compute CLTV.\nLet’s use some simple equations:\nCustomer Value = Average Order Value (AOV)* Purchase Frequency\nChurn Rate: Churn Rate is the % of customers who have not ordered again.\nCustomer Lifetime = 1/ churn rate\nChurn Rate= 1-Repeat Rate\nLet’s get the data and jump into the insights to explore what we have in the data.\nThe bar chart clearly shows that we have maximum number of business coming from the UK. From descriptive statistics, we can see that, the some of the order in a negative quantity. This is practically not possible. This could be the order cancellation or return materials. So, we need to filter Quantity greater than zero. More so, we also will filter the required columns for the CLTV analysis. We need CustomerID, InvoiceDate, InvoiceNo, Quantity, and UnitPrice from the data set.\ndata = uk_data[(uk_data[‘Quantity’]>0)]data=uk_data[[‘CustomerID’,’InvoiceDate’,’InvoiceNo’,’Quantity’,’UnitPrice’]]data[‘TotalPurchase’] = uk_data[‘Quantity’] * uk_data[‘UnitPrice’]\nNow, we shall compute (a) the number of days between the present date and the date of last purchase from each customer, (b) the number of orders for each customer, (c) the sum of purchase price for each customer. Also do further data purification by renaming the columns.\ndata_group= data.groupby(‘CustomerID’).agg({‘InvoiceDate’: lambda date: (date.max() — date.min()).days, ‘InvoiceNo’: lambda num: len(num), ‘Quantity’: lambda quant: quant.sum(), ‘TotalPurchase’: lambda price: price.sum()})# Change the name of columnsdata_group.columns=[‘num_days’, ’num_transactions’, ’num_units’, ’spent_money’]data_group.head()\nNow, we shall compute CLTV using the formulas mentioned earlier.\n# Average Order Valuedata_group[‘avg_order_value’]=uk_data_group[‘spent_money’]/uk_data_group[‘num_transactions’]#Purchase Frequency purchase_frequency=sum(uk_data_group[‘num_transactions’])/uk_data_group.shape[0]# Repeat Raterepeat_rate=uk_data_group[uk_data_group.num_transactions > 1].shape[0]/uk_data_group.shape[0]#Churn Ratechurn_rate=1-repeat_ratepurchase_frequency,repeat_rate,churn_rate\n#Output: (90.37107880642694, 0.9818923743942872, 0.018107625605712774)\nLet’s assume that business making 25% profit.\n# Profit Margindata_group[‘profit_margin’]= data_group[‘spent_money’]*0.25# Customer Valuedata_group[‘CLTV’]= data_group[‘avg_order_value’]*purchase_frequency)/churn_rate#Customer Lifetime Valuedata_group[‘cust_lifetime_value’]=data_group[‘CLTV’]*data_group[‘profit_margin’]\nNow we are going to predict CLTV using Linear Regression Model. We need some data preparation here before pushing the data to regression model.\nuk_data['month_yr'] = uk_data['InvoiceDate'].apply(lambda x: x.strftime('%b-%Y')) # Extract month and year from InvoiceDate.\n# creating a pivot table taking the columns as input, and groups the entries into a two-dimensional table in such a way that provides a multidimensional summation of the data.sale=uk_data.pivot_table(index=[‘CustomerID’],columns=[‘month_yr’],values=’TotalPurchase’,aggfunc=’sum’,fill_value=0).reset_index()sale[‘CLV’]=sale.iloc[:,2:].sum(axis=1) # sum all the months salesale.head()\nNow, let’s build a regression model for existing customers. We need a set of dependent (y) and independent variables (X). So, we shall take last six-months data as independent variables and total revenue over three years as a dependent variable followed by usual ML process of splitting training & test data.\nX=sale[[‘Dec-2011’,“Nov-2011”, ‘Oct-2011’,“Sept-2011”,’Aug-2011',’Jul-2011']]y=sale[[‘CLV’]]#split training set and test setX_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)linreg = LinearRegression() # instantiatelinreg.fit(X_train, y_train) # fitting the model to the training datay_pred = linreg.predict(X_test) # make predictions on the testing setprint(linreg.intercept_)print(linreg.coef_)\nLet’s print R-squared which is the proportion of variance explained by the model, Mean Absolute Error (MAE), Mean Squared Error (MSE), Root Mean Squared Error (RMSE).\nprint(“R-Square:”,metrics.r2_score(y_test, y_pred))print(“MAE:”,metrics.mean_absolute_error(y_test,y_pred))print(“MSE”,metrics.mean_squared_error(y_test, y_pred))print(“RMSE:”,np.sqrt(metrics.mean_squared_error(y_test, y_pred)))\nR-Square: 0.9666074402817513\nMAE: 595.0282284701232\nMSE 2114139.8898678916\nRMSE: 1454.008215199588\nWhen the model is deployed, the ML algorithm helps to understand the patterns; it will also categorize the customers according to their CLTV predictions. The marketing strategy is important here considering that CLTV can figure out most profitable customers, but how we are going to make profit from them, will depend on the adopted marketing strategy. Moreover loyalty programs can be formulated based on the insights.\nIt is not clear how a regression model can be used to forecast the dynamics of buyer behavior well into the future and then tie it all back into a present value for each customer.\nTwo periods of purchasing behavior are required — (a) to define the RFM variables 1 and (b) to arrive at values of the dependent variable(s). It would be better if we were able to create predictions of future purchasing behavior simply using period 1 data alone. Moreover, it would be of best interest to leverage all of the available data for model calibration purposes without using any of it to create a dependent variable for a regression-type analysis.\nThe RFM variables are only imperfect indicators of underlying behavioral traits. Different “slices” of the data will yield different values of the RFM variables and therefore different scoring model parameters. This has important implications when we utilize the observed data from one period to make predictions of future behavior (2) (3).\nThe LR was close to perfect here predicting what an average customer will spend during their lifetime. CLTV helps to design an effective business plan and also provide a chance to scale the business. However, as already discussed, a lot will depend on marketing strategy to extract profit. In general, marketing automation platform manages the customer lifecycle. Marketing platforms orchestrate the marketing campaigns while also automating the movement of leads and customers through the pipeline. Marketing departments use these software applications to plan, coordinate, execute, manage, and measure their campaigns across multiple channels and automate repetitive tasks.\nI can be connected here ."
[ { "code": null, "e": 215, "s": 172, "text": "https://sarit-maitra.medium.com/membership" }, { "code": null, "e": 805, "s": 215, "text": "Customer Life time Value (CLTV) is a quantitative analysis and one of the most important metric to modern customer centric business scenario. I...
C++ Exception Library - domain_error
It is a domain error exception.the domain of a mathematical function is the subset of values that it is defined for. For example, the square root function is only defined for non-negative numbers. Thus, a negative number for such a function would qualify as a domain error. Following is the declaration for std::domain_e...
[ { "code": null, "e": 2877, "s": 2603, "text": "It is a domain error exception.the domain of a mathematical function is the subset of values that it is defined for. For example, the square root function is only defined for non-negative numbers. Thus, a negative number for such a function would qualif...
How To Make Scree Plot in R with ggplot2 - GeeksforGeeks
23 Sep, 2021 In this article, we are going to see how can we plot a Scree plot in R Programming Language with ggplot2. Here we will load the dataset, (Remember to drop the non-numerical column). Since the iris flower dataset contains a species column that is of character type so we need to drop it because PCA works wi...
[ { "code": null, "e": 24851, "s": 24823, "text": "\n23 Sep, 2021" }, { "code": null, "e": 24958, "s": 24851, "text": "In this article, we are going to see how can we plot a Scree plot in R Programming Language with ggplot2. " }, { "code": null, "e": 25182, "s": 249...
Quick Sort on Linked List | Practice | GeeksforGeeks
Sort the given Linked List using quicksort. which takes O(n^2) time in worst case and O(nLogn) in average and best cases, otherwise you may get TLE. Input: In this problem, method takes 1 argument: address of the head of the linked list. The function should not read any input from stdin/console. The struct Node has a d...
[ { "code": null, "e": 387, "s": 238, "text": "Sort the given Linked List using quicksort. which takes O(n^2) time in worst case and O(nLogn) in average and best cases, otherwise you may get TLE." }, { "code": null, "e": 753, "s": 387, "text": "Input:\nIn this problem, method takes...
Android - Auto Complete
If you want to get suggestions , when you type in an editable text field , you can do this via AutoCompleteTextView. It provides suggestions automatically when the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with....
[ { "code": null, "e": 3928, "s": 3607, "text": "If you want to get suggestions , when you type in an editable text field , you can do this via AutoCompleteTextView. It provides suggestions automatically when the user is typing. The list of suggestions is displayed in a drop down menu from which the u...
How to show the date and time the document was last modified with JavaScript?
To show the last modified date with JavaScript, use the lastModified property. You can try to run the following code to display the date and time the document last modified with JavaScript − Live Demo <!DOCTYPE html> <html> <body> <script> var date = document.lastModified; document.write("Las...
[ { "code": null, "e": 1141, "s": 1062, "text": "To show the last modified date with JavaScript, use the lastModified property." }, { "code": null, "e": 1253, "s": 1141, "text": "You can try to run the following code to display the date and time the document last modified with Java...
How to insert Timestamp value in a database using JDBC program?
Timestamp datatype in SQL is similar to Date (in SQL) both store day:month:year:hour:minute:second. In addition to this timestamp stores fractional seconds too. The PreparedStatement interface provides a method named setTimestamp() this method accepts two parameters an integer variable representing the parameter index ...
[ { "code": null, "e": 1223, "s": 1062, "text": "Timestamp datatype in SQL is similar to Date (in SQL) both store day:month:year:hour:minute:second. In addition to this timestamp stores fractional seconds too." }, { "code": null, "e": 1600, "s": 1223, "text": "The PreparedStatement...
SAS - Quick Guide
SAS stands for Statistical Analysis Software. It was created in the year 1960 by the SAS Institute. From 1st January 1960, SAS was used for data management, business intelligence, Predictive Analysis, Descriptive and Prescriptive Analysis etc. Since then, many new statistical procedures and components were introduced i...
[ { "code": null, "e": 2919, "s": 2583, "text": "SAS stands for Statistical Analysis Software. It was created in the year 1960 by the SAS Institute. From 1st January 1960, SAS was used for data management, business intelligence, Predictive Analysis, Descriptive and Prescriptive Analysis etc. Since the...
How to build a dataset from Twitter using Python tweepy | by Angelica Lo Duca | Towards Data Science
In this tutorial, I explain a very simple procedure to extract data from Twitter using the tweepy Python library. The code can be downloaded from my Github repository. In detail, I will implement a strategy for the extraction of the tweets of the previous day with hashtag #covid-19 and automation for a daily extraction...
[ { "code": null, "e": 340, "s": 172, "text": "In this tutorial, I explain a very simple procedure to extract data from Twitter using the tweepy Python library. The code can be downloaded from my Github repository." }, { "code": null, "e": 494, "s": 340, "text": "In detail, I will ...
How to group header content of a table using HTML5 ? - GeeksforGeeks
05 Jun, 2020 In this article, we define to group the header content in a table by using the <th> tag in HTML to set the header cell of a table. Two types of cells in an HTML table. Header Cell: It is used to hold the header information. Standard Cell: It is used to hold the body of data. The working of both tags (<th> ...
[ { "code": null, "e": 31736, "s": 31708, "text": "\n05 Jun, 2020" }, { "code": null, "e": 31904, "s": 31736, "text": "In this article, we define to group the header content in a table by using the <th> tag in HTML to set the header cell of a table. Two types of cells in an HTML ta...
Decision Trees in Machine Learning | by K G Prajwal | Towards Data Science
Ever wondered about how a human brain works while making a decision? The endless possibilities to be comprehended before going down any road, all the mental calculations it performs regarding the rewards and the penalties that must be considered for achieving the best possible route to a decision. Yes, our brain, truly...
[ { "code": null, "e": 586, "s": 172, "text": "Ever wondered about how a human brain works while making a decision? The endless possibilities to be comprehended before going down any road, all the mental calculations it performs regarding the rewards and the penalties that must be considered for achie...
How does modulus work with complex numbers in Python?
Floor and modulus operators (// and % respectively) are not allowed to be used on complex number in Python 3.x. However, these operations are defined for complex numbers in Python 2.7.x >>> x=9+2j >>> y=2+1j >>> x%y Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> x%y TypeError: can't mod comp...
[ { "code": null, "e": 1248, "s": 1062, "text": "Floor and modulus operators (// and % respectively) are not allowed to be used on complex number in Python 3.x. However, these operations are defined for complex numbers in Python 2.7.x" }, { "code": null, "e": 1395, "s": 1248, "text...
5 Things to Know About Python functions | by Aditya Kousik Cotra | Towards Data Science
Functions are an effective way to reuse program codes. Using functions have the benefit of saving space and our choice of name makes our program easily readable. Functions can be defined without an input and are not necessarily required to produce an output. There are many built-in functions in python but we can create...
[ { "code": null, "e": 431, "s": 172, "text": "Functions are an effective way to reuse program codes. Using functions have the benefit of saving space and our choice of name makes our program easily readable. Functions can be defined without an input and are not necessarily required to produce an outp...
Explain JavaScript Regular Expression modifiers with examples
The JavaScript regular expression modifiers are optional part of a regular expression and allow us to perform case insensitive and global searchers. The modifiers can also be combined together. Following are the modifiers − Following is the code for strict comparison in JavaScript switch statement − Live Demo <!DOCTYP...
[ { "code": null, "e": 1256, "s": 1062, "text": "The JavaScript regular expression modifiers are optional part of a regular expression and allow us to perform case insensitive and global searchers. The modifiers can also be combined together." }, { "code": null, "e": 1286, "s": 1256, ...
How to teach AI to play Games: Deep Reinforcement Learning | by Mauro Comi | Towards Data Science
If you are excited about Machine Learning and you’re interested in how it can be applied to Gaming or Optimization, this article is for you. We will see the basics of Reinforcement Learning and Deep Reinforcement Learning (Neural Networks + Q-Learning) applied to the game Snake. Let’s dive into it! Artificial Intellige...
[ { "code": null, "e": 472, "s": 172, "text": "If you are excited about Machine Learning and you’re interested in how it can be applied to Gaming or Optimization, this article is for you. We will see the basics of Reinforcement Learning and Deep Reinforcement Learning (Neural Networks + Q-Learning) ap...
How to change font size in ttk.Button?
Tkinter Ttk is a native library in Tkinter which is used to style the widgets in a Tkinter application. It provides a native GUI interface to all the widgets defined in the application.In order to style the widgets with ttk, we have to import it in the notebook using the command ‘from tkinter import ttk’. For a particu...
[ { "code": null, "e": 1369, "s": 1062, "text": "Tkinter Ttk is a native library in Tkinter which is used to style the widgets in a Tkinter application. It provides a native GUI interface to all the widgets defined in the application.In order to style the widgets with ttk, we have to import it in the ...
How to Create a Black and White Image Using CSS
By specifying grayscale value to the filter property of CSS we can create a black and white image. filter property can be used to apply special effects like blur, drop-shadow to images. The syntax of CSS filter property is as follows − Selector { filter: grayscale(100%); -webkit-filter: grayscale(100%); } The fol...
[ { "code": null, "e": 1248, "s": 1062, "text": "By specifying grayscale value to the filter property of CSS we can create a black and white image. filter property can be used to apply special effects like blur, drop-shadow to images." }, { "code": null, "e": 1298, "s": 1248, "text...
AWK - Basic Syntax
AWK is simple to use. We can provide AWK commands either directly from the command line or in the form of a text file containing AWK commands. We can specify an AWK command within single quotes at command line as shown − awk [options] file ... Consider a text file marks.txt with the following content − 1) Amit Phy...
[ { "code": null, "e": 2000, "s": 1857, "text": "AWK is simple to use. We can provide AWK commands either directly from the command line or in the form of a text file containing AWK commands." }, { "code": null, "e": 2078, "s": 2000, "text": "We can specify an AWK command within si...
How to compare two JavaScript Date Objects?
To compare two date objects with JavaScript, create two dates object and get the recent date to compare it with the custom date. You can try to run the following code to compare two dates − Live Demo <!DOCTYPE html> <html> <body> <script> var date1, date2; date1 = new Date(); documen...
[ { "code": null, "e": 1191, "s": 1062, "text": "To compare two date objects with JavaScript, create two dates object and get the recent date to compare it with the custom date." }, { "code": null, "e": 1252, "s": 1191, "text": "You can try to run the following code to compare two ...
Perl IF...ELSE statement
A Perl if statement can be followed by an optional else statement, which executes when the boolean expression is false. The syntax of an if...else statement in Perl programming language is − if(boolean_expression) { # statement(s) will execute if the given condition is true } else { # statement(s) will execute if...
[ { "code": null, "e": 2340, "s": 2220, "text": "A Perl if statement can be followed by an optional else statement, which executes when the boolean expression is false." }, { "code": null, "e": 2411, "s": 2340, "text": "The syntax of an if...else statement in Perl programming langu...
DAX Information - ISBLANK function
Checks whether a value is blank, and returns TRUE or FALSE. ISBLANK (<value>) value The value or expression you want to test. TRUE or FLASE. = if (ISBLANK([Athlete]), "Name Missing", [Athlete]) This DAX formula returns a column of values – with Athlete name, if present and with the text string Name Missing, otherwis...
[ { "code": null, "e": 2061, "s": 2001, "text": "Checks whether a value is blank, and returns TRUE or FALSE." }, { "code": null, "e": 2081, "s": 2061, "text": "ISBLANK (<value>) \n" }, { "code": null, "e": 2087, "s": 2081, "text": "value" }, { "code": nu...
How to implement custom deserializer using @JsonDeserialize annotation in Java?
The @JsonDeserialize annotation is used to declare custom deserializer while deserializing JSON to Java object. We can implement a custom deserializer by extending the StdDeserializer class with a generic type Employee and need to override the deserialize() method of StdDeserializer class. @Target(value={ANNOTATION_TY...
[ { "code": null, "e": 1354, "s": 1062, "text": "The @JsonDeserialize annotation is used to declare custom deserializer while deserializing JSON to Java object. We can implement a custom deserializer by extending the StdDeserializer class with a generic type Employee and need to override the deserial...
C# - Data Types
The variables in C#, are categorized into the following types − Value types Reference types Pointer types Value type variables can be assigned a value directly. They are derived from the class System.ValueType. The value types directly contain data. Some examples are int, char, and float, which stores numbers, alphabe...
[ { "code": null, "e": 2334, "s": 2270, "text": "The variables in C#, are categorized into the following types −" }, { "code": null, "e": 2346, "s": 2334, "text": "Value types" }, { "code": null, "e": 2362, "s": 2346, "text": "Reference types" }, { "code...
What are static members of a C# Class?
We can define class members as static using the static keyword. When we declare a member of a class as static, it means no matter how many objects of the class are created, there is only one copy of the static member. The keyword static implies that only one instance of the member exists for a class. Static variables a...
[ { "code": null, "e": 1280, "s": 1062, "text": "We can define class members as static using the static keyword. When we declare a member of a class as static, it means no matter how many objects of the class are created, there is only one copy of the static member." }, { "code": null, "e"...