Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.


Sign Up

Articles related to "function"


4 Pandas Plotting Function You Should Know

  • RadViz is a method to visualise N-dimensional data set into a 2D plot.
  • According to Pandas, radviz allows us to project an N-dimensional data set into a 2D space where the influence of each dimension can be interpreted as a balance between the importance of all dimensions.
  • According to Pandas, the bootstrap plot is used to estimate the uncertainty of a statistic by relying on random sampling with replacement.
  • In simpler words, it is used to trying to determine the uncertainty in fundamental statistic such as mean and median by resampling the data with replacement (you could sample the same data multiple times).
  • A lag plot is used to checks whether the time series data is random or not, and if the data is correlated with themselves.
  • We could try to plot the data to see the pattern over time with a simple method.

save | comments | report | share on


Machine Learning - Visualized

  • Our goal is to find the right values for W and B that orients this plane (decision boundary) in such a way that it divides the dataset into the two clusters.
  • An important observation to make here is that the loss is minimized at a particular value for each of these parameters as shown by the red dot.
  • Initially, the values for W and B are chosen randomly and so (w1, loss) will be randomly placed on this curve as shown by the green dot.
  • The large slope (gradient) during the first few epochs (when the green dot is far from the minima) is responsible for this large update to the parameters.
  • So far, we have seen how a simple 3D to 1D mapping, f(x), can be used to fit a decision boundary (2D plane) to a linearly separable dataset (3D).

save | comments | report | share on


Function Arguments: Default, Keyword, and Arbitrary

  • First, to define a function with a default argument value.
  • In the function header, we attach the parameter of interest with an equals sign and the default argument value.
  • Through this article, you will gain expertise in writing functions with both single and multiple default arguments.
  • In this example, we write the function that sums up all the arguments passed to it.
  • In the function definition, we use the parameter *args, then turns all the arguments passed to a function call into a tuple in the function body.
  • There is no maximum value for the parameter when we call the function if we use this method, *args.
  • We will write such a function called print_all that prints out the identifiers and the parameters passed to them.
  • To write such a function, we use the parameter kwargs preceded by a **.

save | comments | report | share on


Data Scientists, Start Using Profilers

  • If you’re looking for a way to speed up your code, a profiler can show you exactly which parts are taking the most time, allowing you to see which sections would benefit most from optimization.
  • When you’re trying to get a better understanding of how your code is running, the first place to start is cProfile, Python’s built-in profiler.
  • As you can see, 89.5% of our time parsing each book is spent in the get_book function — making the HTTP request — further validation that our program is I/O bound rather than CPU bound.
  • Now, with this new info in mind, if we wanted to speed up our code we wouldn’t want to waste our time trying to make our word counter more efficient.

save | comments | report | share on


Data Scientists, Start Using Profilers

  • If you’re looking for a way to speed up your code, a profiler can show you exactly which parts are taking the most time, allowing you to see which sections would benefit most from optimization.
  • When you’re trying to get a better understanding of how your code is running, the first place to start is cProfile, Python’s built-in profiler.
  • As you can see, 89.5% of our time parsing each book is spent in the get_book function — making the HTTP request — further validation that our program is I/O bound rather than CPU bound.
  • Now, with this new info in mind, if we wanted to speed up our code we wouldn’t want to waste our time trying to make our word counter more efficient.

save | comments | report | share on


Data Scientists, Start Using Profilers

  • If you’re looking for a way to speed up your code, a profiler can show you exactly which parts are taking the most time, allowing you to see which sections would benefit most from optimization.
  • When you’re trying to get a better understanding of how your code is running, the first place to start is cProfile, Python’s built-in profiler.
  • As you can see, 89.5% of our time parsing each book is spent in the get_book function — making the HTTP request — further validation that our program is I/O bound rather than CPU bound.
  • Now, with this new info in mind, if we wanted to speed up our code we wouldn’t want to waste our time trying to make our word counter more efficient.

save | comments | report | share on


Data Scientists, Start Using Profilers

  • If you’re looking for a way to speed up your code, a profiler can show you exactly which parts are taking the most time, allowing you to see which sections would benefit most from optimization.
  • When you’re trying to get a better understanding of how your code is running, the first place to start is cProfile, Python’s built-in profiler.
  • As you can see, 89.5% of our time parsing each book is spent in the get_book function — making the HTTP request — further validation that our program is I/O bound rather than CPU bound.
  • Now, with this new info in mind, if we wanted to speed up our code we wouldn’t want to waste our time trying to make our word counter more efficient.

save | comments | report | share on


Create beautiful and interactive Chord Diagrams using Python

  • This particular point stood out to me this week, when I was trying to find an appealing way to visualize the correlation between features in my data.
  • I stumbled upon CHORD Diagrams!(Which we will get to, in a minute) I had seen a few R examples to generate Chord Diagrams using Circlize where you could just pass the properly shaped data to the chordDiagram() function and ta-da!
  • You should have seen the look on my face when I found the Python Plotly implementation of the Chord Diagram.
  • A Chord Diagram represents the flows between a set of distinct items.
  • The above Chord Diagram, visualizes the number of times two entities(Cities in this case) occur together in the itinerary of a traveler, it allows us to study the flow between them.
  • That’s what I try to explore in this article, by creating an effective Chord Diagram with minimal effort.

save | comments | report | share on


Using Pandas Method Chaining to improve code readability

  • We have been talking about using the Pandas pipe function to improve code readability.
  • In this article, let’s have a look at Pandas Method Chaining.
  • For example, query(), assign(), pivot_table(), and in particular pipe() for allowing user-defined methods in method chaining.
  • Cool, let’s go ahead and use Pandas Method Chaining to accomplish them.
  • We’ll use these average age values to impute based on Pclass for Age. All missing ages should be replaced based on Pclass for Age. Let’s check this by running the heatmap on res.
  • The new column is created with a lambda function together with Pandas cut() to convert ages to groups of ranges.
  • However, a very long method chaining could be less readable, especially when other functions get called inside the chain, for example, the cut() is used inside the assign() method in our tutorial.

save | comments | report | share on


Unsupervised Learning — Part 3

  • Well, the unsupervised deep learning part generative adversarial networks come from the key idea that GANs to play the following game: You have a generator and a discriminator.
  • This is the negative loss of the discriminator and this then results in the following minimax game: So the optimal parameter set of the generator can be determined by maximizing V with respect to the discriminator nested into a minimization of the parameters of G with respect to the same value function.
  • Then, you want the expected values of these representations to be the same given for real inputs as well as for generated noise images.
  • So, you use, for example, an Inception v3 pre-trained Network on ImageNet and you want the score distribution to be dominated by one class.

save | comments | report | share on