Giter VIP home page Giter VIP logo

pda_book's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pda_book's Issues

Chapter5/DTW_Implementation.py. you only take the first pixel of every row

Chapter5/DTW_Implementation.py:

for fn in range(1,658):
    img = Image.open("ImgFolder\\{0}.jpg".format(fn))
    arr = array(img)
    list = []
    for n in arr: list.append(n[0][0])
    for n in arr: list.append(n[0][1])
    for n in arr: list.append(n[0][2])
    data[fn] = list

you are taking only the first pixel of every row, and ignore all the rest.
it does not make sense.

Also, in your book, Chapter 5, "Image similarity search", you say:

The trick is to turn the pixels of the image into a numerical sequence, as is shown in the following figure:

and you show a matrix with dij values (original image), and a vector with vi, but you don't explain how you compute those vi.

Chapter 2, WebScraping.py

The structure of the HTML on gold.org has changed. This illustrates the danger of webpage screping, but it also breaks the example given in WebScraping.py.
In order to make things difficult, there are no 'id' attributes on the HTML elements with the prices now.

The result is an error: IndexError: list index out of range.

Changing the line where price is determined to:

price= scraping.findAll("dd",attrs={"class":"value"})[0].text

seems to work.

It might be useful to add that the output file is buffered, so it will take some time before something appears in it.

Question on Chapter 8

In your book, chapter 8, you mention:

However, to visualize all the possible features' combination we will need the binomial coefficient of the number of features. In this case, 13 features are equal to 78 different combinations. Due to this, it is mandatory to perform dimensionality reduction.

We would need to see in 13 dimensions to visualize 13 features. We can only see in 3 dimensions, so we need to perform dimensionality reduction.
So, what where does this 78 number come from, and what does it mean?

Pie Chart is not shown in the browser

Hello sir, I am reading your newly published book. And tried some codes in Chapter 3 on data visualization using D3. I followed the instruction in constructing the D3 Pie chart, but when I run it in my local server, nothing is shown except the header I made. I am new to JavaScript, so I wasn't able to fix this. And by the way, I was not successful in plotting the Bar chart too, I tried to use your codes in this repository and renamed sumPokemon.csv to pokemonByType.csv, but still nothing happens. I was hoping if you could help me with this, so that I can proceed with the other charts. Thanks, below is the code.

<!DOCTYPE html>
<html>
<head>My first D3 Pie Chart</head>
<style>

body {
  font: 16px ARIAL;
}
</style>
<body>
<script src="d3.v3.min.js"></script>
<script>
var w = 1160,
    h = 700,
    radius = Math.min(w, h) / 2;

var color = d3.scale.ordinal()
    .range(["#04B486", "#F2F2F2", "F5F6CE", "#00BFFF"]);

var arc = d3.svg.arc()
    .outerRadius(radius - 10)
    .innerRadius(0);

var pie = d3.layout.pie()
    .sort(null)
    .value(function(d){return d.amount;});

var svg = d3.select("body").append("svg")
    .attr("width", w)
    .attr("height", h)
    .append("g")
    .attr("transform", "translate("+w/2+","+h/2+")");

d3.csv("sumPokemon.csv", function(error, data){
data.forEach(function(d){
d.amount = +d.amount;
});

var g = svg.selectAll(".arc")
    .data(pie(data))
    .enter().append("g")
    .attr("class", "arc");

g.append("path")
    .attr("d", arc)
    .style("fill", function(d){return color(d.data.type);});
g.append("text")
    .attr("transform", function(d){return "translate("+ arc.centroid(d)+")";})
    .attr("dy", ".60em")
    .style("text-anchor", "middle")
    .text(function(d){return d.data.type;});
});
</script>
</body>
</html>

Chapter4, NaiveBayes.py, invalid formula

In Chapter4, NaiveBayes.py, you have:

    for c in c_categories:
        prob_c = float(c_categories[c])/float(c_texts)
        words = list_words(subject_line)
        prob_total_c = prob_c
        for p in words:
            if p in c_words:
                prob_p= float(c_words[p][c])/float(c_tot_words)
                prob_cond = prob_p/prob_c
                prob =(prob_cond * prob_p)/ prob_c
                prob_total_c = prob_total_c * prob

so, this results in prob = (prob_b/prob_c)^2, which is incorrect.
I guess that you should use update prob_total_c not with prob, but with prob_cond, or even prob_p.

RegEx date check (Chapter2)

RegEx.py outputs valid for date 13/01/2013 (mm/dd/yy) ..which shouldn't be the case.

I mean, the logic is wrong for regex. (I modified the variable to take input at run-time)

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.