Uploaded by Rituparn Shukla

Build Your Next Project with Wolfram Alpha API and Python by Martin Heinz Towards Data Science

advertisement
11/19/23, 12:59 PM
archive.today
webpage capture
Webpage
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Saved from https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-a
All snapshots from host towardsdatascience.com
Screenshot
share
download .zip
Sign in
Follow
23 May 2021 02:10:44 UTC
search
no other snapshots from this url
597K Followers
·
Editors' Picks
Features
Deep Dives
Grow
Contribute
report bug or abuse
Buy me a coffee
Get started
About
You have 2 free member-only stories left this month. Sign up for Medium and get an extra one
HANDS-ON TUTORIALS
Build Your Next Project with
Wolfram Alpha API and Python
Let’s get curated data, natural language processing, text-to-speech,
plot rendering and more from Wolfram Alpha into your next project!
Martin Heinz Nov 2, 2020 · 8 min read
Anybody who at some point struggled with math knows Wolfram Alpha and
was probably saved by its ability to solve any equation, plot any function or
visualize logic circuits. Wolfram Alpha can; however, do much more than
that, including chemistry, linguistics or history and most importantly — it
can give you all the answers using its public API. So, in this article we will
explore how you can use it to answer simple questions, solve mathematical
problems, render plots or even describe DNA sequences!
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
1/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Photo by vnwayne fan on Unsplash
Setting Up
Wolfram Alpha API is free (for non-commercial usage), but we still need to
get API key (AppID) to perform queries against the API endpoints. To get
API key we will first create Wolfram ID at
https://account.wolfram.com/login/create. When account is created we
can navigate to developer.wolframalpha.com/portal/myapps, click on the
Sign up to get your first AppID button, fill out Get a New AppID dialog. After
that we will be presented with API key which is called AppID here, which we
can test out with following sample query:
1
from pprint import pprint
2
import requests
3
import os
4
import urllib.parse
5
6
appid = os.getenv('WA_APPID', '...')
7
8
query = urllib.parse.quote_plus("lifespan of a mosquito")
9
query_url = f"http://api.wolframalpha.com/v2/query?" \
10
f"appid={appid}" \
11
f"&input={query}" \
12
f"&format=plaintext" \
13
f"&output=json"
14
15
r = requests.get(query_url).json()
16
17
data = r["queryresult"]["pods"][0]["subpods"][0]
18
datasource = ", ".join(data["datasources"]["datasource"])
19
microsource = data["microsources"]["microsource"]
20
plaintext = data["plaintext"]
21
22
print(f"Result: '{plaintext}' from {datasource} ({microsource}).")
23
# Result: '(9.2 to 11, 52 to 60) days' from AmazingNumbers, TheWikimediaFoundationIncW
sample.py hosted with ❤ by GitHub
view raw
The above code uses Wolfram|Alpha Full Results API to find out what is
lifespan of mosquito. To do so, it makes
http://api.wolframalpha.com/v2/query
GET
with parameters specifying our
AppID for authentication, question in the
plaintext
request to
input
field, format parameter as
(instead of image) and finally, output type which is JSON
(instead of default XML).
We traverse the result as dictionary, looking for interesting fields to print
out. The returned JSON (or XML) can be pretty complex and really the
easiest way to parse it, is to print it and look for any useful fields in there.
Trimmed down example of response for above query would look something
like this:
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
2/17
11/19/23, 12:59 PM
1
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
{ queryresult : { error : False,
2
'pods': [{'error': False,
3
'expressiontypes': {'name': 'Default'},
4
'id': 'Result',
5
'numsubpods': 1,
6
'position': 100,
7
'primary': True,
8
'scanner': 'Data',
9
'subpods': [{'datasources': {'datasource': ['AmazingNumbers
10
'TheWikimediaFo
11
'microsources': {'microsource': 'SpeciesData'}
12
'plaintext': '(9.2 to 11, 52 to 60) '
13
'days',
14
'title': ''}],
15
'title': 'Result'}],
16
'success': True}}
sample_result.py hosted with ❤ by GitHub
view raw
Doing Math
The most useful part of Wolfram Alpha (in my opinion) is the ability to
solve complex mathematical problems. So, let’s try using the API to do some
math:
1
equation = "7 + 2x = 12 - 3x"
2
query = urllib.parse.quote_plus(f"solve {equation}")
3
query_url = f"http://api.wolframalpha.com/v2/query?" \
4
f"appid={appid}" \
5
f"&input={query}" \
6
f"&includepodid=Result" \
7
f"&output=json"
8
9
r = requests.get(query_url).json()
10
11
data = r["queryresult"]["pods"][0]["subpods"][0]
12
plaintext = data["plaintext"]
13
14
print(f"Result of {equation} is '{plaintext}'.")
15
# Result of 7 + 2x = 12 - 3x is 'x = 1'.
equation.py hosted with ❤ by GitHub
view raw
The Full Results API shown in previous section doesn’t just answer some
curious questions, but it also does math (and really almost everything). To
make the API aware that we want to do math — in this case — solve
equation, we need to prepend the actual equation with word
solve . Apart
from the input itself, the query looks very similar to the one in previous
section. One extra thing that's added to this one is
which tells the API that in this case we only want
includepodid
Result
parameter,
pod to be included
in the response. "What is pod, though?", you may ask.
Every result from Wolfram Alpha (both website and API), generally
includes multiple categories of data. This can be for example graph, image,
step-by-step solution or table. Each of these belongs to its own section
called pod, which in turn includes subpods which hold individual pieces of
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
3/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
data. Considering that each response can sometimes include even 10 or so
pods, it’s desirable to describe what we want to receive from the API. To do
that —
podtitle
and more robust
includepodid
- parameters can be used,
as shown above.
The filtered response for above query would therefore look like so:
1
{'queryresult': {'pods': [{'error': False,
2
'expressiontypes': {'name': 'Default'},
3
'id': 'Result',
4
'numsubpods': 1,
5
'position': 100,
6
'primary': True,
7
'scanner': 'Solve',
8
'states': [{'input': 'Result__Step-by-step solution',
9
'name': 'Step-by-step solution',
10
'stepbystep': True}],
11
'subpods': [{'img': {'alt': 'x = 1',
12
'src': 'https://www5a.wolframalpha.com
13
'themes': '1,2,3,4,5,6,7,8,9,10,11,12'
14
'title': 'x = 1'},
15
'plaintext': 'x = 1',
16
'title': ''}],
17
'title': 'Result'}]}}
equation result.py hosted with ❤ by GitHub
view raw
And for comparison same (but graphical) result, but with all the pods
would look like this:
Result with Input, Result, Plot and Number line pods
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
4/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Wolfram Alpha can be great learning resource thanks to ability to show not
just results, but all the computation steps and API can do that too. To get
step-by-step solution for a query, we need to include another parameter
called
podstate , which specifies pod state change. This will replace the
original pod with modified version, which can be - for example - more digits
for decimal number like Pi (
DecimalApproximation ), extended weather data
(more days/months/years) or as in our case - steps to equation solution:
1
equation = "7 + 2x = 12 - 3x"
2
query = urllib.parse.quote_plus(f"solve {equation}")
3
query_url = f"http://api.wolframalpha.com/v2/query?" \
4
f"appid={appid}" \
5
f"&input={query}" \
6
f"&scanner=Solve" \
7
f"&podstate=Result__Step-by-step+solution" \
8
"&format=plaintext" \
9
f"&output=json"
10
11
r = requests.get(query_url).json()
12
13
data = r["queryresult"]["pods"][0]["subpods"]
14
result = data[0]["plaintext"]
15
steps = data[1]["plaintext"]
16
17
print(f"Result of {equation} is '{result}'.\n")
18
print(f"Possible steps to solution:\n\n{steps}")
19
20
# Result of 7 + 2x = 12 - 3x is 'x = 1'.
21
#
22
# Possible steps to solution:
23
#
24
# Solve for x:
25
# 2 x + 7 = 12 - 3 x
26
# Add 3 x to both sides:
27
# 3 x + 2 x + 7 = (3 x - 3 x) + 12
28
# 3 x - 3 x = 0:
29
# 3 x + 2 x + 7 = 12
30
# Grouping like terms, 3 x + 2 x + 7 = (2 x + 3 x) + 7:
31
# (2 x + 3 x) + 7 = 12
32
# 2 x + 3 x = 5 x:
33
# 5 x + 7 = 12
34
# Subtract 7 from both sides:
35
# 5 x + (7 - 7) = 12 - 7
36
# 7 - 7 = 0:
37
# 5 x = 12 - 7
38
# 12 - 7 = 5:
39
# 5 x = 5
40
# Divide both sides of 5 x = 5 by 5:
41
# (5 x)/5 = 5/5
42
# 5/5 = 1:
43
# x = 5/5
44
# 5/5 = 1:
45
# Answer: x = 1
step_by_step.py hosted with ❤ by GitHub
view raw
Rendering Mathematical Markdown
One neat trick you can use Wolfram Alpha API for is to render MathML. If
you’re not familiar with MathML, then here’s quick rundown — MathML
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
5/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
stands for Mathematical Markup Language, it’s an XML based format for
rendering LaTeX-like mathematical expressions in web browsers. Even
though this format has been around for a long time, it’s only really
supported by Firefox, which might make it seem like a bad choice, but
JavaScript display engine called MathJax.js makes it possible to render
MathML in any browser, which makes it a good choice if you want to show
really nice looking complex formulas in LaTeX format in your web
application or blog. With that said, let’s query it!
1
equation = "7 + 2x = 12 - 3x"
2
query = urllib.parse.quote_plus(f"solve {equation}")
3
query_url = f"http://api.wolframalpha.com/v2/query?" \
4
f"appid={appid}" \
5
f"&input={query}" \
6
f"&scanner=Solve" \
7
f"&podstate=Result__Step-by-step+solution" \
8
"&format=mathml" \
9
f"&output=json"
10
11
r = requests.get(query_url).json()
12
13
data = r["queryresult"]["pods"][0]["subpods"]
14
result = data[0]["mathml"]
15
steps = data[1]["mathml"]
16
17
print(f"MathML result of {equation} is:\n")
18
print(f"{result}")
19
print(f"Possible steps to solution:\n\n{steps}")
20
21
# MathML result of 7 + 2x = 12 - 3x is:
22
#
23
# <math xmlns='http://www.w3.org/1998/Math/MathML'
24
#
25
#
26
#
27
#
<mi>x</mi>
28
#
<mo>=</mo>
29
#
30
#
31
# </math>
32
#
33
# Possible steps to solution:
34
# <math xmlns='http://www.w3.org/1998/Math/MathML'
35
#
36
#
37
#
38
#
39
#
40
#
41
#
42
# </math>
mathematica:form='StandardForm'
xmlns:mathematica='http://www.wolfram.com/XML/'>
<mrow>
<mn>1</mn>
</mrow>
mathematica:form='StandardForm'
xmlns:mathematica='http://www.wolfram.com/XML/'>
<mtable displaystyle='true'>
<mtr>
...
</mtr>
</mtable>
mathml.py hosted with ❤ by GitHub
view raw
We again use the example from previous section for querying equation with
step-by-step solution, but substituting
format=plaintext
and similarly replacing all other occurrences of
for
plaintext
format=mathml
with
mathml , e.g.
result = data[0]["mathml"] . Above you can see little bit of the MathML
output that was given by the API, it's very trimmed as the full output is
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
6/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
veeery long, but I would encourage you to try running the query yourself,
pass it through MathJax.js and enjoy the beautiful LaTeX math expressions.
Solving Boolean Algebra
Another pretty common use case for Wolfram Alpha is solving boolean
algebra. Same as with basic equations, all we need to do is pass the formula
to the API and this is what we will get back:
1
formula = "((P AND (Q IMPLIES R)) OR S) AND T"
2
query = urllib.parse.quote_plus(f"solve {formula}")
3
query_url = f"http://api.wolframalpha.com/v2/query?" \
4
f"appid={appid}" \
5
f"&input=solve {formula}" \
6
f"&output=json" \
7
f"&includepodid=Input" \
8
f"&includepodid=MinimalForms" \
9
f"&includepodid=TruthDensity"
10
11
r = requests.get(query_url).json()
12
13
pods = r["queryresult"]["pods"]
14
expression = pods[0]["subpods"][0]["plaintext"]
15
min_forms = "\n".join(pods[1]["subpods"][0]["plaintext"].split("\n")[:-1])
16
truth_density = pods[2]["subpods"][0]["plaintext"].split("=")
17
18
print(f"Expression {expression}: \n")
19
print(f"{min_forms}\n")
20
print(f"Truth density equals {truth_density[0]} which is {truth_density[1]}")
21
22
# Expression ((P ∧ (Q implies R)) ∨ S) ∧ T:
23
#
24
# DNF
| (P ∧ ¬Q ∧ T) ∨ (P ∧ R ∧ T) ∨ (S ∧ T)
25
# CNF
| (P ∨ S) ∧ (¬Q ∨ R ∨ S) ∧ T
26
# ANF
| (P ∧ T) ⊻ (S ∧ T) ⊻ (P ∧ Q ∧ T) ⊻ (P ∧ S ∧ T) ⊻ (P ∧ Q ∧ R ∧ T) ⊻ (P ∧ Q ∧ S
27
# NOR
| (P ⊽ S) ⊽ (¬Q ⊽ R ⊽ S) ⊽ ¬T
28
# NAND | (P ⊼ ¬Q ⊼ T) ⊼ (P ⊼ R ⊼ T) ⊼ (S ⊼ T)
29
# AND
| ¬(¬P ∧ ¬S) ∧ ¬(Q ∧ ¬R ∧ ¬S) ∧ T
30
# OR
| ¬(¬P ∨ Q ∨ ¬T) ∨ ¬(¬P ∨ ¬R ∨ ¬T) ∨ ¬(¬S ∨ ¬T)
31
#
32
# Truth density equals 11/32 which is 34.375%
bool algebra.py hosted with ❤ by GitHub
view raw
The query above doesn’t really show anything new except for specific pods
we selected —
Input , MinimalForms
and
TruthDensity . After parsing data in
these 3 pods, we can see the output which includes nicer form of submitted
input formula, it's other computed forms (CNF, DNF...) as well as truth
density both as fraction and as percentage.
Rendering & Downloading Plots
One of my favourite things to do with Wolfram Alpha has always been
rendering complicated plots. Implementing this doesn’t even require much
of a code change, the only real change is selection of pods and their fields:
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
7/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
1
function = "sin x cos y"
2
query = f"plot {function}"
3
query_url = f"http://api.wolframalpha.com/v2/query?" \
4
f"appid={appid}" \
5
f"&input={query}" \
6
f"&output=json" \
7
f"&includepodid=3DPlot" \
8
f"&includepodid=ContourPlot"
9
10
r = requests.get(query_url).json()
11
12
pods = r["queryresult"]["pods"]
13
plot_3d_url = pods[0]["subpods"][0]["img"]["src"]
14
plot_contour_url = pods[1]["subpods"][0]["img"]["src"]
15
16
img_name = "3d_plot.jpg"
17
img_data = requests.get(plot_3d_url).content
18
with open(img_name, 'wb') as handler:
19
handler.write(img_data)
20
print(f"3D Plot Image Saved to {img_name}.")
render_plot.py hosted with ❤ by GitHub
In this case we use
ContourPlot
img.src
includepodid
view raw
parameter to select
3DPlot
and
pods which hold URLs to images of the respective plots in their
fields. These plots can be then downloaded and written in binary
mode producing following image:
3D Plot
Not Just Math
At this point, I think we’ve seen enough applications for Wolfram Alpha and
math. So, what else we can do? As a simple example, let’s explore some
DNA sequence:
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
8/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
1
query = "AAGCTAGCTAGC"
2
query_url = f"http://api.wolframalpha.com/v2/query?" \
3
f"appid={appid}" \
4
f"&input={query}" \
5
f"&scanner=Genome" \
6
f"&output=json" \
7
f"&includepodid=Length" \
8
f"&includepodid=AminoAcidSequence" \
9
f"&includepodid=MeltingTemperature" \
10
11
r = requests.get(query_url).json()
12
13
pods = r["queryresult"]["pods"]
14
15
length = {
16
"title": pods[0]["title"],
17
"value": pods[0]["subpods"][0]["plaintext"]
18
}
19
amino_sequence = {
20
"title": pods[1]["title"],
21
"value": pods[1]["subpods"][0]["plaintext"].replace(") ", ")\n")
22
}
23
melting_temp = {
24
"title": pods[2]["title"],
25
26
"value": pods[2]["subpods"][0]["plaintext"]
}
27
28
print(f"{length['title']}: {length['value']}\n")
29
print(f"{amino_sequence['title']}:\n {amino_sequence['value']}\n")
30
print(f"{melting_temp['title']}: {melting_temp['value']}")
31
32
# Length: 12 base pairs
33
#
34
# Amino acid sequence:
35
#
36
# | AAG | CUA | GCU | AGC
37
#
38
#
39
#
40
# Oligonucleotide melting temperature: 48.5 °C (degrees Celsius)
41
# (under standard PCR conditions)
(5'-3' frame 1)
↓
|
↓
|
↓
|
↓
Lys | Leu | Ala | Ser
dna.py hosted with ❤ by GitHub
view raw
We’re again using same API endpoint, but this time we submit string
representing DNA sequence. You might notice that we didn’t need to
include keyword before the query like earlier with
time instead of using keyword, we added
scanner
solve
or
plot . Well, this
parameter, which
specifies the subject area of search query, which in this case is
Genome . To
find which scanner will return relevant data for some query, it's easiest to
run the query without
scanner
parameter and look for the
scanner
attribute of each pod that has the expected data.
DNA sequences are obviously not the only cool thing that you can search
for. Some of the other interesting topics can be for example history,
chemistry, transportation or music — just to name a few.
Natural Language (Spoken) Answers
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pytho…
9/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
If you only look for information, then the examples and APIs in previous
examples are sufficient. However, if you want/need more natural sounding
answer to your queries, then you can use Spoken Results API:
1
question = "what is the most spoken language in the world?"
2
query_url = f"http://api.wolframalpha.com/v1/spoken?" \
3
f"appid={appid}" \
4
f"&i={question}" \
5
6
r = requests.get(query_url)
7
8
print(r.text)
9
# The most spoken language by total number of speakers is English. The total number of
spoken api.py hosted with ❤ by GitHub
Queries for the
v1/spoken
view raw
endpoint are very simple. All we need to pass in is
an AppID and our questions in the
i
parameter. This produces response in
form of a full sentence rather than plain fact. This can be quite useful when
building clever chat bots or maybe as an input for text-to-speech engine.
Chatting with Conversation API
As kind of an extension to Spoken Results API, Wolfram Alpha also provides
Conversational API, which allows you to ask follow up questions and
therefore have conversation with the API. So, let’s try it out and ask
Wolfram Alpha something:
1
question = "Where are Falkland Islands?"
2
location = "47.01,16.93"
3
query_url = f"http://api.wolframalpha.com/v1/conversation.jsp?" \
4
f"appid={appid}" \
5
f"&geolocation={appid}" \
6
f"&i={question}" \
7
8
r = requests.get(query_url).json()
9
answer = r["result"]
10
conversation_id = r["conversationID"]
11
host = r["host"]
12
13
print(f"{question}: '{answer}'")
14
15
followup_question = "How far is it from here?"
16
query_url = f"http://{host}/api/v1/conversation.jsp?" \
17
f"appid={appid}" \
18
f"&conversationID={conversation_id}" \
19
f"&i={followup_question}" \
20
21
r = requests.get(query_url).json()
22
answer = r["result"]
23
print(f"{followup_question}: '{answer}'")
24
25
26
# Where are Falkland Islands?: 'The Falkland Islands is in South America.'
27
# How far is it from here?: 'The answer is about 13217 kilometers.'
conversation_api.py hosted with ❤ by GitHub
view raw
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
10/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Considering that we want to ask multiple questions, we also have to make
multiple queries. First of them is directed at
includes a questions in the
geolocation
i
v1/conversation
endpoint and
parameter. We also specify our location with
parameter - this is one of the optional values (other are
ip
and
units ) that can provide context for the questions. This first request pretty
much does the same thing as Spoken Results API, meaning that it returns
information in form of full sentence.
The fun starts when we ask followup questions. To do so, we make another
query, this time however, we send it to the host that was provided as part of
the response to first query (
included
conversationID
host = r["host"] ). The first response also
which we also have to pass in for API to know
what was said prior to that.
The second query then returns same type of result as the first one, which
allows us to keep on asking more questions using provided
and
conversationID
host .
One last thing I want to highlight here is how the the questions and answers
can nicely flow and use context. In this particular example, we used “How
far is it from here?” as followup question, without actually specifying what
“it” or “here” really is. These information were automatically inferred from
previous question and
geolocation
parameter.
Conclusion
This article is really just a tip of the iceberg as far as information available
from Wolfram Alpha goes. These APIs can be used for much more than just
some math and I think it’s great starting point for building cool bots, smart
devices or voice-based applications. Even though it’s not free for
commercial use, you still get 2000 requests per month which is plenty to
start some cool project. I recommend checking out
https://products.wolframalpha.com/api/ for documentation for each API
endpoint as well as Wolfram Alpha landing page which shows all the
different topics that might give you some idea as to what you could build
with it.
😉
This article was originally posted at martinheinz.dev
Writing More Idiomatic and Pythonic Code
Idioms and conventions that will make your Python code readable,
effective, concise and reliable.
towardsdatascience.com
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
11/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Build a Stunning README For Your GitHub Profile
Show off your projects and skills on GitHub with its hidden new
feature — GitHub Profile READMEs!
towardsdatascience.com
Scraping News and Articles From Public APIs with Python
Let’s explore New York Times, The Guardian, HackerNews and other
APIs and gather some news data for your next project!
towardsdatascience.com
Sign up for The Variable
By Towards Data Science
Every Thursday, the Variable delivers the very best of Towards Data Science: from
hands-on tutorials and cutting-edge research to original features you don't want to
miss. Take a look.
Get this newsletter
127
Python
You'll need to sign in or create an account to receive this
newsletter.
1
Programming
Data Science
Technology
Hands On Tutorials
More from Towards Data Science
Follow
Your home for data science. A Medium publication sharing concepts, ideas and
codes.
Marco Del Pra · Nov 2, 2020
GETTING STARTED
Time Series Forecasting with Deep
Learning and Attention Mechanism
An overview of the architecture and the implementation details of the
most important Deep Learning algorithms for Time Series
Forecasting
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
12/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Image from https://images.unsplash.com/photo-1506555191898-a76bacf004ca?ixlib=rb1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60
Motivation
Time Series Forecasting has always been a very important area of research
in many domains because many different types of data are stored as time
series. For example we can find a lot of time series data in medicine,
weather forecasting, biology, supply chain management and stock prices
forecasting, etc.
Given the growing availability of data and computing power in the recent
years, Deep Learning has become a fundamental part of the new generation
of Time Series Forecasting models, obtaining excellent results.
While in classical Machine Learning models - such as autoregressive models
(AR) or exponential smoothing - feature engineering…
Read more · 19 min read
Leigh Johnson · Nov 2, 2020
484
2
HANDS-ON TUTORIALS
Budget Automation for Bounding Box
Annotation
Learn how to use TensorFlow.js to speed up data annotation
👋
Introduction
Originally published via bitsy.ai
Data collection and preparation are the foundation of every machine
learning application. You’ve heard it before: “Garbage in, garbage out” in
reference to an algorithm’s limited capability to correct for inaccurate, poorquality, or biased input data.
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
13/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
The cost of quality annotated data prompted a cottage industry of
tools/platforms for speeding up the data labeling process. Besides the
SaaS/on-prem startup ecosystem, each of the major cloud providers (AWS,
Microsoft, Google) launched an automated data labeling product in the last
two years. Understandably, these services are often developed with
Premium/Enterprise users, features, and price points in mind.
On a limited budget, am I stuck labeling everything by hand?
Good…
Read more · 10 min read
72
1
JP Hwang · Nov 2, 2020
GETTING STARTED
Mad Maps – visualizing geographical data
for maximum impact
How to effectively communicate data on maps for clear, insightful
insights with Python (code and data included)
The U.S. presidential election is upon us again. You have no doubt had
maps flood your Twitter timeline and news feeds already, and the next few
weeks after Nov. 3rd will see an escalation of that.
We take maps for granted these days, and it’s not difficulty to see why.
Smartphones have commoditised technology to accurately locate us and
provide live directions to the 5 nearest Japanese restaurants with at least a
4.0 rating. Maps have never been more integrated in our lives, even though
just a decade ago people still used street directories. (Shudders)
But it would be doing…
Read more · 10 min read
70
Steve Roberts · Nov 2, 2020
A BABY ROBOT’S GUIDE TO REINFORCEMENT LEARNING
Thompson Sampling
Multi-Armed Bandits: Part 5
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
14/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
Photo by National Cancer Institute on Unsplash
Read more · 17 min read
147
5
Jingles (Hong Jing) · Nov 2, 2020
GETTING STARTED
How Convolutional Layers Work in Deep
Learning Neural Networks?
An animated ELI5 way to understand convolutions and its parameters
Image by stokpic from Pixabay
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
15/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
In deep learning, convolutional layers have been major building blocks in
many deep neural networks. The design was inspired by the visual cortex,
where individual neurons respond to a restricted region of the visual field
known as the receptive field. A collection of such fields overlap to cover the
entire visible area.
Though convolutional layers were initially applied in computer vision, its
shift-invariant characteristics have allowed convolutional layers to be
applied in natural language processing, time series, recommender systems,
and signal processing.
The easiest way to understand a convolution is by thinking of it as a sliding
window function applied…
Read more · 10 min read
80
Read more from Towards Data Science
More From Medium
Data Scientists
Will be Extinct
in 10 years
Towards Data
There Will be a
Shortage Of
Data Science
Jobs in the
Next 5 Years?
Science
Pranjal Saxena in
Mikhail Mew in
Towards Data
100 Helpful
Python Tips
You Can Learn
Before
Finishing Your
Morning
Coffee
Science
Fatos Morina in
Simulate Reallife Events in
Python Using
SimPy
Khuyen Tran in
Towards Data
Science
Towards Data
Science
Be Careful
When
Interpreting
Predictive
Models in
Search of
Causal Insights
Automate
Excel with
Python
3 visualizations
that changed
my life
KahEm Chu in
Lukas Hurych in
Towards Data
Towards Data
Science
Science
5 Essential
Python
function and
skills you
should know as
a data scientist
Harsh Maheshwari
Scott Lundberg in
in Towards Data
Towards Data
Science
Science
About
Help
Legal
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
16/17
11/19/23, 12:59 PM
Build Your Next Project with Wolfram Alpha API and Python | by Martin Heinz | Towards Data Science
https://archive.is/20210523021044/https://towardsdatascience.com/build-your-next-project-with-wolfram-alpha-api-and-pyth…
17/17
Download