Dataquest: Jupyter Notebook for Beginners: A Tutorial

https://ift.tt/2IoSrNZ

The Jupyter Notebook is an incredibly powerful tool for interactively developing and presenting data science projects. A notebook integrates code and its output into a single document that combines visualisations, narrative text, mathematical equations, and other rich media. The intuitive workflow promotes iterative and rapid development, making notebooks an increasingly popular choice at the heart of contemporary data science, analysis, and increasingly science at large. Best of all, as part of the open source Project Jupyter, they are completely free.

The Jupyter project is the successor to the earlier IPython Notebook, which was first published as a prototype in 2010. Although it is possible to use many different programming languages within Jupyter Notebooks, this article will focus on Python as it is the most common use case.

To get the most out of this tutorial you should be familiar with programming, specifically Python and pandas specifically. That said, if you have experience with another language, the Python in this article shouldn't be too cryptic and pandas should be interpretable. Jupyter Notebooks can also act as a flexible platform for getting to grips with pandas and even Python, as it will become apparent in this article.

We will:

  • Cover the basics of installing Jupyter and creating your first notebook
  • Delve deeper and learn all the important terminology
  • Explore how easily notebooks can be shared and published online. Indeed, this article is a Jupyter Notebook! Everything here was written in the Jupyter Notebook environment and you are viewing it in a read-only form.

Example data analysis in a Jupyter Notebook

We will walk through a sample analysis, to answer a real-life question, so you can see how the flow of a notebook makes the task intuitive to work through ourselves, as well as for others to understand when we share it with them.

So, let's say you're a data analyst and you've been tasked with finding out how the profits of the largest companies in the US changed historically. You find a data set of Fortune 500 companies spanning over 50 years since the list's first publication in 1955, put together from Fortune's public archive.

As we shall demonstrate, Jupyter Notebooks are perfectly suited for this investigation. First, let's go ahead and install Jupyter.

Installation

The easiest way for a beginner to get started with Jupyter Notebooks is by installing Anaconda. Anaconda is the most widely used Python distribution for data science and comes pre-loaded with all the most popular libraries and tools. As well as Jupyter, some of the biggest Python libraries wrapped up in Anaconda include NumPy, pandas and Matplotlib, though the full 1000+ list is exhaustive. This lets you hit the ground running in your own fully stocked data science workshop without the hassle of managing countless installations or worrying about dependencies and OS-specific (read: Windows-specific) installation issues.

To get Anaconda, simply:

  1. Download the latest version of Anaconda for Python 3 (ignore Python 2.7).
  2. Install Anaconda by following the instructions on the download page and/or in the executable.

If you are a more advanced user with Python already installed and prefer to manage your packages manually, you can just use pip:

pip3 install jupyter

Creating Your First Notebook

In this section, we're going to see how to run and save notebooks, familiarise ourselves with their structure, and understand the interface. We'll become intimate with some core terminology that will steer you towards a practical understanding of how to use Jupyter Notebooks by yourself and set us up for the next section, which steps through an example data analysis and brings everything we learn here to life.

Running Jupyter

On Windows, you can run Jupyter via the shortcut Anaconda adds to your start menu, which will open a new tab in your default web browser that should look something like the following screenshot.

Jupyter control panel

This isn't a notebook just yet, but don't panic! There's not much to it. This is the Notebook Dashboard, specifically designed for managing your Jupyter Notebooks. Think of it as the launchpad for exploring, editing and creating your notebooks.

Be aware that the dashboard will give you access only to the files and sub-folders contained within Jupyter's start-up directory; however, the start-up directory can be changed. It is also possible to start the dashboard on any system via the command prompt (or terminal on Unix systems) by entering the command jupyter notebook; in this case, the current working directory will be the start-up directory.

The astute reader may have noticed that the URL for the dashboard is something like http://localhost:8888/tree. Localhost is not a website, but indicates that the content is being served from your local machine: your own computer. Jupyter's Notebooks and dashboard are web apps, and Jupyter starts up a local Python server to serve these apps to your web browser, making it essentially platform independent and opening the door to easier sharing on the web.

The dashboard's interface is mostly self-explanatory — though we will come back to it briefly later. So what are we waiting for? Browse to the folder in which you would like to create your first notebook, click the "New" drop-down button in the top-right and select "Python 3" (or the version of your choice).

New notebook menu

Hey presto, here we are! Your first Jupyter Notebook will open in new tab — each notebook uses its own tab because you can open multiple notebooks simultaneously. If you switch back to the dashboard, you will see the new file Untitled.ipynb and you should see some green text that tells you your notebook is running.

What is an ipynb File?

It will be useful to understand what this file really is. Each .ipynb file is a text file that describes the contents of your notebook in a format called JSON. Each cell and its contents, including image attachments that have been converted into strings of text, is listed therein along with some metadata. You can edit this yourself — if you know what you are doing! — by selecting "Edit > Edit Notebook Metadata" from the menu bar in the notebook.

You can also view the contents of your notebook files by selecting "Edit" from the controls on the dashboard, but the keyword here is "can"; there's no reason other than curiosity to do so unless you really know what you are doing.

The notebook interface

Now that you have an open notebook in front of you, its interface will hopefully not look entirely alien; after all, Jupyter is essentially just an advanced word processor. Why not take a look around? Check out the menus to get a feel for it, especially take a few moments to scroll down the list of commands in the command palette, which is the small button with the keyboard icon (or Ctrl + Shift + P).

New Jupyter Notebook

There are two fairly prominent terms that you should notice, which are probably new to you: cells and kernels are key both to understanding Jupyter and to what makes it more than just a word processor. Fortunately, these concepts are not difficult to understand.

  • A kernel is a "computational engine" that executes the code contained in a notebook document.
  • A cell is a container for text to be displayed in the notebook or code to be executed by the notebook's kernel.

Cells

We'll return to kernels a little later, but first let's come to grips with cells. Cells form the body of a notebook. In the screenshot of a new notebook in the section above, that box with the green outline is an empty cell. There are two main cell types that we will cover:

  • A code cell contains code to be executed in the kernel and displays its output below.
  • A Markdown cell contains text formatted using Markdown and displays its output in-place when it is run.

The first cell in a new notebook is always a code cell. Let's test it out with a classic hello world example. Type print('Hello World!') into the cell and click the run button Notebook Run Button in the toolbar above or press Ctrl + Enter. The result should look like this:

print('Hello World!')

Hello World!

When you ran the cell, its output will have been displayed below and the label to its left will have changed from In [ ] to In [1]. The output of a code cell also forms part of the document, which is why you can see it in this article. You can always tell the difference between code and Markdown cells because code cells have that label on the left and Markdown cells do not. The "In" part of the label is simply short for "Input," while the label number indicates when the cell was executed on the kernel — in this case the cell was executed first. Run the cell again and the label will change to In [2] because now the cell was the second to be run on the kernel. It will become clearer why this is so useful later on when we take a closer look at kernels.

From the menu bar, click Insert and select Insert Cell Below to create a new code cell underneath your first and try out the following code to see what happens. Do you notice anything different?

import time
time.sleep(3)

This cell doesn't produce any output, but it does take three seconds to execute. Notice how Jupyter signifies that the cell is currently running by changing its label to In [*].

In general, the output of a cell comes from any text data specifically printed during the cells execution, as well as the value of the last line in the cell, be it a lone variable, a function call, or something else. For example:

def say_hello(recipient):
    return 'Hello, {}!'.format(recipient)

say_hello('Tim')

'Hello, Tim!'

You'll find yourself using this almost constantly in your own projects, and we'll see more of it later on.

Keyboard shortcuts

One final thing you may have observed when running your cells is that their border turned blue, whereas it was green while you were editing. There is always one "active" cell highlighted with a border whose colour denotes its current mode, where green means "edit mode" and blue is "command mode."

So far we have seen how to run a cell with Ctrl + Enter, but there are plenty more. Keyboard shortcuts are a very popular aspect of the Jupyter environment because they facilitate a speedy cell-based workflow. Many of these are actions you can carry out on the active cell when it's in command mode.

Below, you'll find a list of some of Jupyter's keyboard shortcuts. You're not expected to pick them up immediately, but the list should give you a good idea of what's possible.

  • Toggle between edit and command mode with Esc and Enter, respectively.
  • Once in command mode:
    • Scroll up and down your cells with your Up and Down keys.
    • Press A or B to insert a new cell above or below the active cell.
    • M will transform the active cell to a Markdown cell.
    • Y will set the active cell to a code cell.
    • D + D (D twice) will delete the active cell.
    • Z will undo cell deletion.
    • Hold Shift and press Up or Down to select multiple cells at once.
      • With multple cells selected, Shift + M will merge your selection.
  • Ctrl + Shift + -, in edit mode, will split the active cell at the cursor.
  • You can also click and Shift + Click in the margin to the left of your cells to select them.

Go ahead and try these out in your own notebook. Once you've had a play, create a new Markdown cell and we'll learn how to format the text in our notebooks.

Markdown

Markdown is a lightweight, easy to learn markup language for formatting plain text. Its syntax has a one-to-one correspondance with HTML tags, so some prior knowledge here would be helpful but is definitely not a prerequisite. Remember that this article was written in a Jupyter notebook, so all of the narrative text and images you have seen so far was achieved in Markdown. Let's cover the basics with a quick example.

# This is a level 1 heading
## This is a level 2 heading
This is some plain text that forms a paragraph.
Add emphasis via **bold** and __bold__, or *italic* and _italic_.

Paragraphs must be separated by an empty line.

* Sometimes we want to include lists.
 * Which can be indented.

1. Lists can also be numbered.
2. For ordered lists.

[It is possible to include hyperlinks](https://www.example.com)

Inline code uses single backticks: `foo()`, and code blocks use triple backticks:

```
bar()
```

Or can be intented by 4 spaces:

    foo()

And finally, adding images is easy: ![Alt text](https://www.example.com/image.jpg)

When attaching images, you have three options:

  • Use a URL to an image on the web.
  • Use a local URL to an image that you will be keeping alongside your notebook, such as in the same git repo.
  • Add an attachment via "Edit > Insert Image"; this will convert the image into a string and store it inside your notebook .ipynb file.
  • Note that this will make your .ipynb file much larger!

There is plenty more detail to Markdown, especially around hyperlinking, and it's also possible to simply include plain HTML. Once you find yourself pushing the limits of the basics above, you can refer to the official guide from the creator, John Gruber, on his website.

Kernels

Behind every notebook runs a kernel. When you run a code cell, that code is executed within the kernel and any output is returned back to the cell to be displayed. The kernel's state persists over time and between cells — it pertains to the document as a whole and not individual cells.

For example, if you import libraries or declare variables in one cell, they will be available in another. In this way, you can think of a notebook document as being somewhat comparable to a script file, except that it is multimedia. Let's try this out to get a feel for it. First, we'll import a Python package and define a function.

import numpy as np

def square(x):
    return x * x

Once we've executed the cell above, we can reference np and square in any other cell.

x = np.random.randint(1, 10)
y = square(x)

print('%d squared is %d' % (x, y))

1 squared is 1

This will work regardless of the order of the cells in your notebook. You can try it yourself, let's print out our variables again.

print('Is %d squared is %d?' % (x, y))

Is 1 squared is 1?

No surprises here! But now let's change y.

y = 10

What do you think will happen if we run the cell containing our print statement again? We will get the output Is 4 squared is 10?!

Most of the time, the flow in your notebook will be top-to-bottom, but it's common to go back to make changes. In this case, the order of execution stated to the left of each cell, such as In [6], will let you know whether any of your cells have stale output. And if you ever wish to reset things, there are several incredibly useful options from the Kernel menu:

  • Restart: restarts the kernel, thus clearing all the variables etc that were defined.
  • Restart & Clear Output: same as above but will also wipe the output displayed below your code cells.
  • Restart & Run All: same as above but will also run all your cells in order from first to last.

If your kernel is ever stuck on a computation and you wish to stop it, you can choose the Interupt option.

Choosing a kernal

You may have noticed that Jupyter gives you the option to change kernel, and in fact there are many different options to choose from. Back when you created a new notebook from the dashboard by selecting a Python version, you were actually choosing which kernel to use.

Not only are there kernels for different versions of Python, but also for over 100 languages including Java, C, and even Fortran. Data scientists may be particularly interested in the kernels for R and Julia, as well as both imatlab and the Calysto MATLAB Kernel for Matlab. The SoS kernel provides multi-language support within a single notebook. Each kernel has its own installation instructions, but will likely require you to run some commands on your computer.

Example analysis

Now we've looked at what a Jupyter Notebook is, it's time to look at how they're used in practice, which should give you a clearer understanding of why they are so popular. It's finally time to get started with that Fortune 500 data set mentioned earlier. Remember, our goal is to find out how the profits of the largest companies in the US changed historically.

It's worth noting that everyone will develop their own preferences and style, but the general principles still apply, and you can follow along with this section in your own notebook if you wish, which gives you the scope to play around.

Naming your notebooks

Before you start writing your project, you'll probably want to give it a meaningful name. Perhaps somewhat confusingly, you cannot name or rename your notebooks from the notebook app itself, but must use either the dashboard or your file browser to rename the .ipynb file. We'll head back to the dashboard to rename the file you created earlier, which will have the default notebook file name Untitled.ipynb.

You cannot rename a notebook while it is running, so you've first got to shut it down. The easiest way to do this is to select "File > Close and Halt" from the notebook menu. However, you can also shutdown the kernel either by going to "Kernel > Shutdown" from within the notebook app or by selecting the notebook in the dashboard and clicking "Shutdown" (see image below).

A running notebook

You can then select your notebook and and click "Rename" in the dashboard controls.

A running notebook

Note that closing the notebook tab in your browser will not "close" your notebook in the way closing a document in a traditional application will. The notebook's kernel will continue to run in the background and needs to be shut down before it is truly "closed" — though this is pretty handy if you accidentally close your tab or browser! If the kernel is shut down, you can close the tab without worrying about whether it is still running or not.

Once you've named your notebook, open it back up and we'll get going.

Setup

It's common to start off with a code cell specifically for imports and setup, so that if you choose to add or change anything, you can simply edit and re-run the cell without causing any side-effects.

%matplotlib inline

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

sns.set(style="darkgrid")

We import pandas to work with our data, Matplotlib to plot charts, and Seaborn to make our charts prettier. It's also common to import NumPy but in this case, although we use it via pandas, we don't need to explicitly. And that first line isn't a Python command, but uses something called a line magic to instruct Jupyter to capture Matplotlib plots and render them in the cell output; this is one of a range of advanced features that are out of the scope of this article.

Let's go ahead and load our data.

df = pd.read_csv('fortune500.csv')

It's sensible to also do this in a single cell in case we need to reload it at any point.

Save and Checkpoint

Now we've got started, it's best practice to save regularly. Pressing Ctrl + S will save your notebook by calling the "Save and Checkpoint" command, but what this checkpoint thing?

Every time you create a new notebook, a checkpoint file is created as well as your notebook file; it will be located within a hidden subdirectory of your save location called .ipynb_checkpoints and is also a .ipynb file. By default, Jupyter will autosave your notebook every 120 seconds to this checkpoint file without altering your primary notebook file. When you "Save and Checkpoint," both the notebook and checkpoint files are updated. Hence, the checkpoint enables you to recover your unsaved work in the event of an unexpected issue. You can revert to the checkpoint from the menu via "File > Revert to Checkpoint."

Investigating our data set

Now we're really rolling! Our notebook is safely saved and we've loaded our data set df into the most-used pandas data structure, which is called a DataFrame and basically looks like a table. What does ours look like?

df.head()

.dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}

Year Rank Company Revenue (in millions) Profit (in millions)
0 1955 1 General Motors 9823.5 806
1 1955 2 Exxon Mobil 5661.4 584.8
2 1955 3 U.S. Steel 3250.4 195.4
3 1955 4 General Electric 2959.1 212.6
4 1955 5 Esmark 2510.8 19.1
df.tail()

.dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}

Year Rank Company Revenue (in millions) Profit (in millions)
25495 2005 496 Wm. Wrigley Jr. 3648.6 493
25496 2005 497 Peabody Energy 3631.6 175.4
25497 2005 498 Wendy's International 3630.4 57.8
25498 2005 499 Kindred Healthcare 3616.6 70.6
25499 2005 500 Cincinnati Financial 3614.0 584

Looking good. We have the columns we need, and each row corresponds to a single company in a single year.

Let's just rename those columns so we can refer to them later.

df.columns = ['year', 'rank', 'company', 'revenue', 'profit']

Next, we need to explore our data set. Is it complete? Did pandas read it as expected? Are any values missing?

len(df)

25500

Okay, that looks good — that's 500 rows for every year from 1955 to 2005, inclusive.

Let's check whether our data set has been imported as we would expect. A simple check is to see if the data types (or dtypes) have been correctly interpreted.

df.dtypes

year         int64
rank         int64
company     object
revenue    float64
profit      object
dtype: object

Uh oh. It looks like there's something wrong with the profits column — we would expect it to be a float64 like the revenue column. This indicates that it probably contains some non-integer values, so let's take a look.

non_numberic_profits = df.profit.str.contains('[^0-9.-]')
df.loc[non_numberic_profits].head()

.dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}

year rank company revenue profit
228 1955 229 Norton 135.0 N.A.
290 1955 291 Schlitz Brewing 100.0 N.A.
294 1955 295 Pacific Vegetable Oil 97.9 N.A.
296 1955 297 Liebmann Breweries 96.0 N.A.
352 1955 353 Minneapolis-Moline 77.4 N.A.

Just as we suspected! Some of the values are strings, which have been used to indicate missing data. Are there any other values that have crept in?

set(df.profit[non_numberic_profits])

{'N.A.'}

That makes it easy to interpret, but what should we do? Well, that depends how many values are missing.

len(df.profit[non_numberic_profits])

369

It's a small fraction of our data set, though not completely inconsequential as it is still around 1.5%. If rows containing N.A. are, roughly, uniformly distributed over the years, the easiest solution would just be to remove them. So let's have a quick look at the distribution.

bin_sizes, _, _ = plt.hist(df.year[non_numberic_profits], bins=range(1955, 2006))

Missing value distribution

At a glance, we can see that the most invalid values in a single year is fewer than 25, and as there are 500 data points per year, removing these values would account for less than 4% of the data for the worst years. Indeed, other than a surge around the 90s, most years have fewer than half the missing values of the peak. For our purposes, let's say this is acceptable and go ahead and remove these rows.

df = df.loc[~non_numberic_profits]
df.profit = df.profit.apply(pd.to_numeric)

We should check that worked.

len(df)

25131

df.dtypes

year         int64
rank         int64
company     object
revenue    float64
profit     float64
dtype: object

Great! We have finished our data set setup.

If you were going to present your notebook as a report, you could get rid of the investigatory cells we created, which are included here as a demonstration of the flow of working with notebooks, and merge relevant cells (see the Advanced Functionality section below for more on this) to create a single data set setup cell. This would mean that if we ever mess up our data set elsewhere, we can just rerun the setup cell to restore it.

Plotting with matplotlib

Next, we can get to addressing the question at hand by plotting the average profit by year. We might as well plot the revenue as well, so first we can define some variables and a method to reduce our code.

group_by_year = df.loc[:, ['year', 'revenue', 'profit']].groupby('year')
avgs = group_by_year.mean()
x = avgs.index
y1 = avgs.profit

def plot(x, y, ax, title, y_label):
    ax.set_title(title)
    ax.set_ylabel(y_label)
    ax.plot(x, y)
    ax.margins(x=0, y=0)

Now let's plot!

fig, ax = plt.subplots()
plot(x, y1, ax, 'Increase in mean Fortune 500 company profits from 1955 to 2005', 'Profit (millions)')

Increase in mean Fortune 500 company profits from 1955 to 2005

Wow, that looks like an exponential, but it's got some huge dips. They must correspond to the early 1990s recession and the dot-com bubble. It's pretty interesting to see that in the data. But how come profits recovered to even higher levels post each recession?

Maybe the revenues can tell us more.

y2 = avgs.revenue
fig, ax = plt.subplots()
plot(x, y2, ax, 'Increase in mean Fortune 500 company revenues from 1955 to 2005', 'Revenue (millions)')

Increase in mean Fortune 500 company revenues from 1955 to 2005

That adds another side to the story. Revenues were no way nearly as badly hit, that's some great accounting work from the finance departments.

With a little help from Stack Overflow, we can superimpose these plots with +/- their standard deviations.

def plot_with_std(x, y, stds, ax, title, y_label):
    ax.fill_between(x, y - stds, y + stds, alpha=0.2)
    plot(x, y, ax, title, y_label)

fig, (ax1, ax2) = plt.subplots(ncols=2)
title = 'Increase in mean and std Fortune 500 company %s from 1955 to 2005'
stds1 = group_by_year.std().profit.as_matrix()
stds2 = group_by_year.std().revenue.as_matrix()
plot_with_std(x, y1.as_matrix(), stds1, ax1, title % 'profits', 'Profit (millions)')
plot_with_std(x, y2.as_matrix(), stds2, ax2, title % 'revenues', 'Revenue (millions)')
fig.set_size_inches(14, 4)
fig.tight_layout()

jupyter-notebook-tutorial_48_0

That's staggering, the standard deviations are huge. Some Fortune 500 companies make billions while others lose billions, and the risk has increased along with rising profits over the years. Perhaps some companies perform better than others; are the profits of the top 10% more or less volatile than the bottom 10%?

There are plenty of questions that we could look into next, and it's easy to see how the flow of working in a notebook matches one's own thought process, so now it's time to draw this example to a close. This flow helped us to easily investigate our data set in one place without context switching between applications, and our work is immediately sharable and reproducible. If we wished to create a more concise report for a particular audience, we could quickly refactor our work by merging cells and removing intermediary code.

Sharing your notebooks

When people talk of sharing their notebooks, there are generally two paradigms they may be considering. Most often, individuals share the end-result of their work, much like this article itself, which means sharing non-interactive, pre-rendered versions of their notebooks; however, it is also possible to collaborate on notebooks with the aid version control systems such as Git.

That said, there are some nascent companies popping up on the web offering the ability to run interactive Jupyter Notebooks in the cloud.

Before you share

A shared notebook will appear exactly in the state it was in when you export or save it, including the output of any code cells. Therefore, to ensure that your notebook is share-ready, so to speak, there are a few steps you should take before sharing:

  1. Click "Cell > All Output > Clear"
  2. Click "Kernel > Restart & Run All"
  3. Wait for your code cells to finish executing and check they did so as expected

This will ensure your notebooks don't contain intermediary output, have a stale state, and executed in order at the time of sharing.

Exporting your notebooks

Jupyter has built-in support for exporting to HTML and PDF as well as several other formats, which you can find from the menu under "File > Download As." If you wish to share your notebooks with a small private group, this functionality may well be all you need. Indeed, as many researchers in academic institutions are given some public or internal webspace, and because you can export a notebook to an HTML file, Jupyter Notebooks can be an especially convenient way for them to share their results with their peers.

But if sharing exported files doesn't cut it for you, there are also some immensely popular methods of sharing .ipynb files more directly on the web.

GitHub

With the number of public notebooks on GitHub exceeding 1.8 million by early 2018, it is surely the most popular independent platform for sharing Jupyter projects with the world. GitHub has integrated support for rendering .ipynb files directly both in repositories and gists on its website. If you aren't already aware, GitHub is a code hosting platform for version control and collaboration for repositories created with Git. You'll need an account to use their services, but standard accounts are free.

Once you have a GitHub account, the easiest way to share a notebook on GitHub doesn't actually require Git at all. Since 2008, GitHub has provided its Gist service for hosting and sharing code snippets, which each get their own repository. To share a notebook using Gists:

  1. Sign in and browse to gist.github.com.
  2. Open your .ipynb file in a text editor, select all and copy the JSON inside.
  3. Paste the notebook JSON into the gist.
  4. Give your Gist a filename, remembering to add .iypnb or this will not work.
  5. Click either "Create secret gist" or "Create public gist."

This should look something like the following:

Creating a Gist

If you created a public Gist, you will now be able to share its URL with anyone, and others will be able to fork and clone your work.

Creating your own Git repository and sharing this on GitHub is beyond the scope of this tutorial, but GitHub provides plenty of guides for you to get started on your own.

An extra tip for those using git is to add an exception to your .gitignore for those hidden .ipynb_checkpoints directories Jupyter creates, so as not to commit checkpoint files unnecessarily to your repo.

Nbviewer

Having grown to render hundreds of thousands of notebooks every week by 2015, NBViewer is the most popular notebook renderer on the web. If you already have somewhere to host your Jupyter Notebooks online, be it GitHub or elsewhere, NBViewer will render your notebook and provide a shareable URL along with it. Provided as a free service as part of Project Jupyter, it is available at nbviewer.jupyter.org.

Initially developed before GitHub's Jupyter Notebook integration, NBViewer allows anyone to enter a URL, Gist ID, or GitHub username/repo/file and it will render the notebook as a webpage. A Gist's ID is the unique number at the end of its URL; for example, the string of characters after the last backslash in https://gist.github.com/username/50896401c23e0bf417e89cd57e89e1de. If you enter a GitHub username or username/repo, you will see a minimal file browser that lets you explore a user's repos and their contents.

The URL NBViewer displays when displaying a notebook is a constant based on the URL of the notebook it is rendering, so you can share this with anyone and it will work as long as the original files remain online — NBViewer doesn't cache files for very long.

Final Thoughts

Starting with the basics, we have come to grips with the natural workflow of Jupyter Notebooks, delved into IPython's more advanced features, and finally learned how to share our work with friends, colleagues, and the world. And we accomplished all this from a notebook itself!

It should be clear how notebooks promote a productive working experience by reducing context switching and emulating a natural development of thoughts during a project. The power of Jupyter Notebooks should also be evident, and we covered plenty of leads to get you started exploring more advanced features in your own projects.

If you'd like further inspiration for your own Notebooks, Jupyter has put together a gallery of interesting Jupyter Notebooks that you may find helpful and the Nbviewer homepage links to some really fancy examples of quality notebooks. Also check out our list of Jupyter Notebook tips.

Want to learn more about Jupyter Notebooks? We have a guided project you may be interested in.



from Planet Python https://ift.tt/1dar6IN
via IFTTT

Urban Bungle: Atlanta Cyber Attack Puts Other Cities on Notice

https://ift.tt/2H9SLRs


Soon after Atlanta City Auditor Amanda Noble logged onto her work computer the morning of March 22, she knew something was wrong. The icons on her desktop looked different—in some cases replaced with black rectangles—and she noticed many of the files on her desktop had been renamed with “weapologize” or “imsorry” extensions. Noble called the city’s chief information security officer to report the problem and left a message. Next, she called the help desk and was put on hold for a while. “At that point, I realized that I wasn’t the only one in the office with computer problems,” Noble says.

Those computer problems were part of a high-profile “ransomware” cyberattack on the City of Atlanta that has lasted nearly two weeks and has yet to be fully resolved. During that time the metropolis has struggled to recover encrypted data on employees’ computers and restore services on the municipal Web site. The criminals initially gave the city seven days to pay about $51,000 in the cryptocurrency bitcoin to get the decryption key for their data. That deadline came and went last week, yet several services remain offline, suggesting the city likely did not pay the ransom. City officials would not comment on the matter when contacted by Scientific American.

The Department of Watershed Management, for example, still cannot accept online or telephone payments for water and sewage bills, nor can the Department of Finance issue business licenses through its Web page. The Atlanta Municipal Court has been unable to process ticket payments either online or in person due to the outage and has had to reschedule some of its hearings. The city took down two of its online services voluntarily as a security precaution: the Hartsfield–Jackson Atlanta International Airport wi-fi network and the ability to process service requests via the city’s 311 Web site portal, according to Anne Torres, Atlanta’s director of communications. Both are now back online, with airport wi-fi restored Tuesday morning.

The ransomware used to attack Atlanta is called SamSam. Like most malicious software it typically enters computer networks through software whose security protections have not been updated. When attackers find vulnerabilities in a network, they use the ransomware to encrypt files there and demand payment to unlock them. Earlier this year attackers used a derivative of SamSam to lock up files at Hancock Regional Hospital in Greenfield, Ind. The health care institution paid nearly $50,000 to retrieve patient data. “The SamSam ransomware used to attack Atlanta is interesting because it gets into a network and spreads to multiple computers before locking them up,” says Jake Williams, founder of computer security firm Rendition Infosec. “The victim then has greater incentive to pay a larger ransom in order to regain control of that network of locked computers.”

SamSam has been one of the most successful ransomware programs to date, having pulled in an estimated $850,000 in ransom money since it first appeared in late 2015. By comparison, the WannaCry ransomware that made headlines a year ago when it was used to attack European hospitals, telecoms and railways netted about $140,000 in bitcoin.

The city’s technology department—Atlanta Information Management (AIM)—contacted local law enforcement, along with the FBI, Department of Homeland Security, Secret Service and independent forensic experts to help assess the damage and investigate the attack. The attackers set up an online payment portal for the city but soon took the site offline after a local television station published a screen shot of the ransom note, which included a link to the bitcoin wallet meant to collect the ransom.

Several clues indicate Atlanta likely did not pay the attackers, Williams says. “Ransomware gangs typically cut off communications once their victims get law enforcement involved,” he says. “Atlanta made it clear at a press conference soon after the malware was detected” that they had done so. The length of time it has taken to slowly bring services back online also suggests the cyber criminals abandoned Atlanta without decrypting the city’s files, Williams says. “If that’s the case, the city’s IT staff spent the past week rebuilding Atlanta’s online systems using backed-up data that had not been hit by the ransomware,” he says, adding that any data not backed up is likely “lost for good.”

“If the city had paid the ransom, I would have expected them to bring up systems more quickly than they have done,” says Justin Cappos, a professor of computer science and engineering at New York University’s Tandon School of Engineering. “Assuming the city did not pay the ransom, their ability to recover their systems at all shows that they at least did a good job backing up their data.”

One silver lining in the cloud hanging over Atlanta’s computer network—it is unlikely the attackers targeted Atlanta specifically, Williams says. The attackers likely were out on the internet looking for vulnerable computers to attack when they stumbled onto Atlanta’s network and the ransomware automatically encrypted its data. That might explain why they attacked Atlanta and then went quiet after law enforcement got involved, he adds. “They weren’t necessarily looking to exploit a large city and it wasn’t worth possibly getting caught,” Williams says. Baltimore officials came to a similar conclusion last week after a ransomware attack took down the city’s computer-aided dispatch system for 911 and 311 calls. Baltimore’s technology staff attributed the attack to opportunistic hackers who took advantage of inadvertent changes made to a firewall meant to protect the city’s network that instead left it vulnerable for about 24 hours.

City Auditor Noble has been using her personal laptop and city-issued mobile phone to do her job since the ransomware struck. As of Tuesday afternoon she had not tried to use her work computer although AIM gave city employees the go-ahead to use their machines last week. As part of the recovery employees were told last Wednesday to reboot their computers and change their passwords, Noble says.

People concerned about ransomware locking up their work or personal computers should back up their data, not just on a network service like Google Drive or Apple’s iCloud but on an actual hard disk that can be disconnected from their computer, Cappos says. The ransomware attacks against Atlanta, Baltimore and other municipalities should cause cities think about whether they would fare any better in the same situation, Williams says, adding, “If it can happen to them, it could happen to you, too.”



from Scientific American https://ift.tt/n8vNiX
via IFTTT

Google veteran Jeff Dean takes over as company’s AI chief

https://ift.tt/2Gx8PeT


Programmer Jeff Dean was one of Google’s earliest employees, and is credited with helping to create some of the fundamental technologies that powered the tech giant’s rise in the early 2000s. Now he’s been put in charge of Google’s future — taking over as head of the company’s artificial intelligence unit.

The move is part of a reshuffle at Google, first reported by The Information and confirmed by CNBC, that’s seems designed to push AI into more of the company’s products. Previously, AI product development was overseen along with search by senior vice president of engineering, John Giannandrea . Now, this role is being split into two, with Dean taking over AI, and Ben Gomes leading the development of search.

The reshuffle seems designed to push AI into more Google products

Breaking out AI as its own unit suggests Google wants to infuse the technology into more practical parts of its business. (It still has two pure AI research organizations: the Google Brain team, and the London-based DeepMind, acquired in 2014.) This prioritizing of AI has become common in the tech world, and the move follows a similar reorganization at Microsoft announced last week, which also made machine learning more central.

Dean’s own experience in AI is extensive; he previously co-founded the Google Brain team, and will continue to lead it in his new role. Google Brain has spearhead the company’s use of deep learning, a type of AI that underwent a renaissance in the early 2010s and powers the field’s most useful applications, from self-driving cars to medical analysis. Dean is also involved with development of TensorFlow, Google’s machine learning framework, which is distributed for free to developers, and which has proved to be a big part of the company’s AI offering.

Dean is also something of a legend among Googlers, and over the years has even inspired a joke format (similar to Chuck Norris facts) that emphasizes his coding prowess. For example, did you know that Jeff Dean’s PIN is the last four digits of Pi, or that Jeff Dean’s keyboard only has two keys, “0” and “1”? Now they just need to come up with some Jeff Dean AI jokes.



from The Verge https://ift.tt/1jLudMg
via IFTTT

Cap Ethereum Total Supply, Says Vitalik Buterin

https://ift.tt/2Gs4g9G




from Hacker News https://ift.tt/YV9WJO
via IFTTT

Author: Vitalik Buterin
Category: Meta
Published: 2018 Apr 1

In order to ensure the economic sustainability of the platform under the widest possible variety of circumstances, and in light of the fact that issuing new coins to proof of work miners is no longer an effective way of promoting an egalitarian coin distribution or any other significant policy goal, I propose that we agree on a hard cap for the total quantity of ETH.

During the next hard fork that alters reward distributions (likely phase 1 Casper), this proposal requires redenominating all in-protocol rewards, including mining rewards, staking interest, staking rewards in the sharding system and any other future rewards that may be devised, in "reward units", where the definition of reward units is:

1 RU = (1 - CURRENT_SUPPLY / MAX_SUPPLY) ETH

I recommend setting MAX_SUPPLY = 120,204,432, or exactly 2x the amount of ETH sold in the original ether sale.

Assuming MAX_SUPPLY = 120 million, and given the current supply of 98.5 million, that means that 1 RU is now equal to 1 - 98.5m/120m ~= 0.1792 ETH, so if a hard fork were to be implemented today, the 3 ETH block reward would become 16.74 RU. In one month, the ETH supply will grow to ~99.1 million, so 1 RU will reduce to 0.1742 ETH, and so the block reward in ETH would be 16.74 * 0.1742 = 2.91555.

In the longer term, the supply would exponentially approach the max cap and the rewards would exponentially approach zero, so if hypothetically Ethereum stays with proof of work forever, this would halve rewards every 744 days. In reality, however, rewards will decrease greatly with the switch to proof of stake, and fees such as rent (as well as slashed validators) will decrease the ETH supply, so the actual ETH supply will reach some equilibrium below MAX_SUPPLY where rewards and penalties/fees cancel out, and so rewards will always remain at some positive level above zero.

If for some reason this EIP is adopted at a point where it is too late to set a max cap at 120 million, it is also possible to set a higher max cap. I would recommend 144,052,828 ETH, or exactly 2x the total amount released in the genesis block including both the sale and premines.

April Fools’ Day 2018: the best (and lamest) pranks

https://ift.tt/2J90C22

April Fools’ Day is upon us, bringing with it a deluge of terrible jokes, ill-advised pranks, and the occasional inspired product concept. The “holiday” has been around for centuries, and companies from all over the internet have been imposing their jokes on us for the last couple of days.

While most are pretty groan-worthy, some are actually a bit entertaining, so we’ve rounded up some of the best (and some of the lamest) to check out. We’ll update this list throughout the day as new jokes (“jokes?”) emerge.

23andMe + Lexus

23andMe teamed up with Lexus to ... use your DNA to figure out which Lexus is right for you, tailoring a vehicle just for you, which you can start by licking the steering wheel. Right. Funny.

BritBox

British VOD service BritBox announced “Interp-Brit,” a feature for US viewers that allows them to toggle the dialogue between British and American accents. The results are actually pretty amusing.

Courses.com.au

Australia’s Courses.com.au is the country’s largest online educational course directory, and they’ve launched a course called “Diploma of Human Survival (AI) (SKYN37)” to prepare humans for the coming dark times that Elon Musk has been warning us about. There’s some clever bits in here: you can subscribe to the course for either 6.5 bitcoin or 12 “untainted” potatoes, and there’s individual course units like SCAV101 - Scavenging Food, AVDE101 - Avoiding Detection, INRU101 - Identifying Intruders and SHELT1010 - Shelter. It also says that it’ll help you get a job as a “Bunker Security Specialist”, a “Gasoline Boy,” or a “Bot Detection Specialist.”

Google

Every year, Google releases a handful of fake products and games. This year, its engineers have turned Google Maps into a large Where’s Waldo? adventure, but they’ve done a bunch of others as well. There’s a Google Cloud Hummus API, while Google Japan put together a “physical handwriting version of the GBoard virtual keyboard, and Google Australia has been rebranded as Googz.

Appropriately, the Files Go team also went and made a Bad Joke detector, which uses “the first fully decentralized deep neural network” to identify terrible jokes.

Jeff VanderMeer

Image: Jeff VanderMeer

We’re big fans of science fiction and Weird author Jeff VanderMeer and his Area X trilogy (Annihilation, Authority, and Acceptance). He “announced” this morning that his publisher was releasing a re-written kid’s edition of the trilogy, complete with illustrations and new covers. We’d read them.

LEGO

Image: Lego

LEGO’s fake product of the day is clever, and something that actually needs to be invented: a vacuum cleaner that not only picks up bricks, but stores them by color and shape (and separates out dirt on the floor). Anyone who’s stepped on one of these in the middle of the night or who has a LEGO-obsessed child knows what I’m talking about.

Netflix

Netflix announced that it is acquiring comedian Seth Rogen, saying that he signed a deal to “transfer full ownership of his personal autonomy to Netflix, Inc.” It’s essentially an ad for Rogen’s comedy special, which drops on April 6th.

Netflix has been racing to pick original content and to sign filmmakers and actors to exclusive deals — like Adam Sandler, Ryan Murphy, and Shonda Rhimes — but the idea of a Silicon Valley company owning a person is a bit creepy.

Niantic

Image: Niantic

Pokémon GO studio Niantic announced that it’s launching a new graphics engine for their AR game: one that takes it down to 8-Bit graphics for that retro look.

Roku

Roku “announced” a new product to help bingers who don’t want the added hassle of wiping their hands or even handling the remote for their Smart TV: Streaming Socks. These gesture-based garments allow you to swipe through your options, select something to play, and come in with a built-in heater. There’s even a locator for when one inevitably goes missing.

SodaStream

Carbination device maker SodaStream has released an infomercial featuring Shahs of Sunset reality star Reza Farahan and Game of Thrones’ Thor Bjornsson, for a device called the SodaSoak, which is designed to carbonate your bathtub. The company launched a fake website for the “product”, and even convinced retailer Bed Bath & Beyond to put up a retail listing (where it’s sold out, of course).

Snapchat

Photo by Tom Warren / The Verge

Snapchat had a bit of fun at Facebook’s expense today, creating an Instagram-style filter that makes it look like Russian bots are liking your posts

Sprint

Sprint’s contribution to the day is the “Sprint Magic Ball,” which... is a soccer ball that acts as a network small cell? Sure.

Stephen King

Stephen King has been a vocal critic of Maine’s Republican governor Paul LePage (as well as President Donald Trump, who King says has blocked him on Twitter). Earlier today, he “launched” a campaign page to run for office.

Sadly, King didn’t put together a fake campaign video, instead opting to Rickroll visitors, saying that “political office is one horror story that even Stephen King doesn’t want to do.” He’s not the first to pull this sort of stunt: Star Trek actor George Takei made a similar announcement last year.

T-Mobile

T-Mobile announced that it was bringing back the Danger Hightop — originally a slider phone that was available between 2002 and 2010 — as the Sidekick, a bright pink high-top shoe. The world’s first “foot phone,” which comes with a selfie camera on the toe and a screen on the bottom (hopefully scratch proof). Cute, but Get Smart has you beat, T-Mobile.

ThinkGeek

Image: ThinkGeek

ThinkGeek famously reveals a bunch of joke products on April 1st, some of which are clever and might actually be turned into a real product — like the Tauntaun sleeping bag from a couple of years ago. This year’s products include the Klingon Alphabet Fridge Magnets (which I would totally buy), to ones that are a bit more lame, like the Rick & Morty Screaming Sun Alarm Clock or the 4d6andMe Stat Discovery Kit.



from The Verge https://ift.tt/1jLudMg
via IFTTT

McDavid Shouldn’t Win the Hart Trophy

https://ift.tt/2IfydWN

With the NHL season winding down and the Stanley Cup Playoffs in sight, it’s time to turn our attention to some of the NHL Awards that are handed out for the regular season. Recently, some debate has surrounded the Hart Memorial Trophy and how it should be awarded. The award is given to the player that’s judged to be the most valuable to his team. Seems simple enough, but also vague enough to create confusion on who is eligible to win the award.

Connor McDavid Hart Trophy

Connor McDavid cleaned up in last year’s NHL Awards. (Stephen R. Sylvanie-USA TODAY Sports)

Historically, the award has gone to a player that’s heading to the playoffs, with there only being a few times that it hasn’t. This season, Connor McDavid seems to be the obvious frontrunner with his league-leading 102 points, but is he actually the best choice and should he even be in contention for the award of most valuable player to his team when the Edmonton Oilers have missed the playoffs?

Winning the Hart Trophy and Missing the Playoffs

Only a few times in NHL history has a player won the Hart Trophy and not made the playoffs in the same season. The last and most notable time this happened was back in the 1987-88 NHL season when Mario Lemieux won while the Pittsburgh Penguins missed the playoffs.

The 1987-88 Pittsburgh Penguins Comparison

Now, there are some comparables to McDavid’s season to Lemieux’s 1987-88 season. If McDavid wins the Art Ross Trophy, which looks certain, then they will have both won the scoring title while their team missed the playoffs. But there are some differences too.

Pittsburgh was a playoff team, no doubt about it, but Pittsburgh had two factors going against them. Firstly, the top four teams in each of the four divisions made the playoffs. The problem was that each division had five teams except for Pittsburgh’s Patrick Division, which had six teams.

Mario Lemieux, Pittsburgh Penguins

Mario Lemieux dominated his time in the NHL. (Photo by Bruce Bennett Studios/Getty Images)

The second problem was that the Patrick Division was full of great teams all within a few points of each other. Pittsburgh finished last in their division with 81 points, while the New York Rangers and New Jersey Devils finished ahead of them with 82 points. New Jersey grabbed the last playoff spot in the division, which meant that Pittsburgh missed the playoffs by one point.

To really drive home the point that Pittsburgh was a playoff team, look no further than the point difference in each division. The Patrick Division had only a seven-point difference between the division-leading 88-point New York Islanders and the 81-point Penguins. Meanwhile, in the Norris Division, there was a point difference of 42 points between the division-leading 93-point Detroit Red Wings and the 51-point Minnesota North Stars.

Ironically, the Toronto Maple Leafs took the last playoff spot in the Norris Division with just 52 points.

Edmonton missed the playoffs this season but wasn’t nearly as close as Pittsburgh was all those years ago. McDavid looks like he will win the Art Ross Trophy with 102 points in 77 games, but there are a couple of players close behind. Lemieux, meanwhile, had 168 points in 77 games with Wayne Gretzky trailing behind with 149 points.

Connor McDavid Oilers

Connor McDavid will almost certainly win the Art Ross trophy again this year. (Amy Irvin / The Hockey Writers)

Although the circumstances look the same, it’s totally different. Lemieux deserved to win the Hart Trophy that season because of how totally dominant he was in the points race and how absurdly close Pittsburgh was to making the playoffs.

How Should the Hart Trophy Winner Be Decided?

McDavid looks to finish the season as the top point scorer in the NHL and is arguably the best player in the world. But that’s not what the Hart Trophy is about. McDavid will get his recognition as the best player with the Art Ross Trophy, but the Hart Trophy is for the player that made the biggest difference in his team completing its goal.

Now, the goal of every team during the regular season is to make the playoffs. So why should a trophy for the most valuable player go to someone who didn’t make the playoffs?

McDavid is clearly the most valuable player to Edmonton but has he been more valuable than Taylor Hall has been to New Jersey or Nathan MacKinnon to the Colorado Avalanche? No.

Taylor Hall, New Jersey Devils, NHL

Taylor Hall is a strong Hart Trophy candidate this season. (Ed Mulholland-USA TODAY Sports)

The way of measuring each player’s value to his team and others is if that team could still make the playoffs without that player. Neither New Jersey or Colorado would even be in the playoff picture without Hall and MacKinnon as they are dragging both their teams into the postseason.

This is not the best player or most points award; it’s about being the most valuable to one’s team in making the playoffs. That’s why we have to go back 30 years just to find a player that’s an exception to the rule.

McDavid is one of the best in the NHL, but he shouldn’t win the Hart Trophy. The goal of every team is to win the Stanley Cup and the first step is making the playoffs. Unfortunately, even McDavid’s talent wasn’t enough to pull the Oilers into the postseason, so it makes no sense labeling him the most valuable player in the NHL.

The post McDavid Shouldn’t Win the Hart Trophy appeared first on The Hockey Writers.



from The Hockey Writers https://ift.tt/2k7pXhT
via IFTTT

ThinkPad X1 Carbon 2018 review: The only laptop in a professional’s paradise

https://ift.tt/2GFQnE7

Valentina Palladino

reader comments 0

ThinkPads are unmistakable. While other OEMs focus on achieving the thinnest and lightest chassis, the perfect shade of rose gold to attract the masses, and nearly invisible bezels, Lenovo has given the ThinkPad family thoughtful updates that keep its original focus and also attempt to stay on top of the newest laptop design and use innovations.

The 2018 ThinkPad X1 Carbon combines a familiar yet durable and sleek design with a few new features—an HDR-ready screen, a webcam shutter, and new mics. While these are small updates overall, they show that Lenovo continues to pay attention to what its customers want as well as what they may want in the future. The new X1 Carbon reminds us all that Lenovo's classic laptop line can hold its own against flashier, trendier competing devices—it can even outshine them in some ways.

Look and feel

Lenovo has given ThinkPad diehards plenty of reasons to love these premium work laptops, and the sixth-gen ThinkPad X1 Carbon doesn't skimp on any of them. The carbon fiber chassis on this 14-inch laptop makes this device incredibly light and comfortable to work with and tote to various work locations.

Specs at a glance: Lenovo ThinkPad X1 Carbon (2018)
Worst Best As reviewed
Screen 14-inch 1920 x 1080 FHD IPS anti-glare 14-inch 2560 x 1440 HDR WQHD IPS glossy display 14-inch 2560 x 1440 HDR WQHD IPS glossy display
OS Windows 10 Home Windows 10 Pro Windows 10 Pro
CPU Intel Core i5-8250U (up to 3.4GHz) Intel Core i7-8650U (up to 4.2GHz) Intel Core i7-8650U (up to 4.2GHz)
RAM 8GB LPDDR3 16GB LPDDR3 16GB LPDDR3
HDD 256GB PCIe SSD NVMe v1.1.0 1TB PCIe SSD NVMe v1.1.0 512GB PCIe SSD NVMe v1.1.0
GPU Intel UHD Graphics 620
Networking Intel Dual-Band Wireless-AC 8265, Bluetooth 4.2
Ports Two USB 3.1 ports, two Thunderbolt ports, HDMI port, microSD card reader, headphone/mic combo jack, lock slot
Size 12.74 x 8.55 x 0.63 inches (323.5 mm x 217.1 mm x 15.95 mm)
Weight 2.49 pounds
Battery 4-cell 57Whr
Warranty One year
Price $1,519 $2,620 $2,333
Other perks fingerprint sensor next to trackpad, webcam shutter, TrackPoint ball

Weighing 2.49 pounds, the X1 Carbon is even lighter than some of the most popular ultrabooks available now, including the new Dell XPS 13 laptop. While some of those ultrabooks incorporate soft-touch material on palm rests and other areas, Lenovo blankets the X1 Carbon with it, giving its lid, palm rests, and every other inch a friendly-yet-durable feel.

Lenovo made sure the X1 Carbon could withstand extreme temperatures, shocks, and vibrations by having it pass 12 MIL-spec tests. Its durability combined with its light design make it an intriguing contender for workers who travel often, or who regularly find themselves working in unfamiliar places. It's also refreshing to see an ultrabook that hasn't been influenced by the latest color or texture trends. Other OEMs try to speak to a number of different types of users with metallic-colored or white-accented laptops. But Lenovo knows that most ThinkPad customers prioritize the happy balance of build quality and classic design over the latest finishes that are taking consumer electronics by storm.

The display options for the X1 Carbon emphasize the importance of this balance. My review unit has a 2560 x 1440 HDR IPS non-touch display, the highest-quality display you can have on this ThinkPad. It can reach up to 500 nits of brightness, supports HDR content, and will support Dolby Vision later this year.

My review unit sports the highest-quality display possible: a 2560 x 1440 HDR IPS non-touch panel. Categorized as DisplayHDR 400, this panel reaches up to 500 nits of brightness and will support Dolby Vision later this year. It's nice to have that HDR label, but DisplayHDR 400 panels aren't radically different than non-HDR displays in terms of color gamut and black level performance. Don't expect the same type of HDR performance as you'd find on an HDR-ready TV, since the standards for PC monitors and laptops panels are different than those applied to televisions.

Most X1 Carbon models come with 1920 x 1080 FHD displays, alternating between anti-glare and glossy finishes. Only one of the FHD options comes with a touch panel, too. While some will be bummed that they can't get a 4K panel on the X1 Carbon, Lenovo opted for more practical options that will suit the majority of users' needs.

Unless you work in a creative industry or primarily use the device for media consumption, a 4K panel isn't necessary. Sure, they're beautiful to use and behold, but you probably don't need to pay the premium for it. The arguments for a touchscreen on a laptop are more nuanced. I've explained my thoughts on touch panels on laptops (note, not convertibles) before: they're nice to have, but not incredibly useful on a device with a screen that tilts back 180 degrees at most. But I'm glad Lenovo added one touchscreen option for users who find those panels more useful on laptops than I do.

The X1 Carbon's display has a 16:9 aspect ratio, making it slightly wider than the 3:2 aspect ratio displays on other ultrabooks. This widescreen design is actually better suited on a media-focused device, but it didn't bother me as much as I thought it might. Displays with 3:2 aspect ratio show more of a document or webpage before you need to scroll, so I just spent a bit more time scrolling than I would have on different device.

The X1 Carbon has the best variety of ports I've seen on a new ultrabook: it has two USB 3.1 ports, two Thunderbolt ports that support charging, data transfer, and DisplayPort, a full-sized HDMI port, and a microSD card slot, and a headphone/mic combo jack. It also has the ThinkPad side dock, allowing it to connect to Lenovo's various USB docks, external displays, and other accessories. I'm happy when an OEM includes just one regular USB port, since so many have been quick to embrace the Type-C life before the dongle life has completely vanished. Two regular USB ports will undoubtedly sway some power-users who simply can't switch over to Type C completely yet because of work or personal demands.

Two far-field mics also sit inside the new X1 Carbon, allowing you to talk to Cortana from up to four meters away. I'm not much of a Cortana user, particularly because I typically don't need to talk to my laptop when I could easily look up what I need while working on it already. But these far-field mics have become standard on most laptops as virtual assistants become more prevalent in our mobile and stationary electronics.

Keyboard, trackpad, and camera

A stellar keyboard marks all ThinkPads, and the one on the X1 Carbon makes for a fantastic typing experience. Each key is quite satisfying to click thanks to the 1.8mm of travel, and the full-sized, standard layout means there are no unlikely key surprises awaiting you. As someone who makes a living from typing words, the X1 Carbon has been one of my favorite devices to all day, every day for work.

The red TrackPoint ball sits at the meeting point among the G, H, and B keys. This method of navigation isn't the most comfortable for me, but I can understand how some would prefer it to even the modestly-sized trackpad that sits just beneath the keyboard (Ars' Peter Bright is, like many others, an avid TrackPoint user). The TrackPoint also sits slightly deeper in the chassis than the rest of the keys, making it hard to mistake it for a key or accidentally press it while typing.

The X1 Carbon's trackpad is fairly standard for a ThinkPad and includes physical right- and left-click keys at the top of the square. The center key lets you scroll more easily with the TrackPoint ball as well. I only wish that the trackpad was slightly bigger, given the luxurious space it gleans on other competing ultrabooks.

The "Match-In" fingerprint sensor sits on the right side of the trackpad, giving all users one Windows Hello biometric log-in option. This fingerprint sensor has a fully encapsulated SoC, meaning all of its enrollment, pattern storage, and biometric matching happens on the chip itself, rather than on other parts of the system. This makes for a more secure biometric login option since your fingerprint information doesn't float between the sensor and the rest of the PC.

The newest X1 Carbon includes a webcam shutter as a standard feature, allowing you to block the camera whenever you want. It takes considerable force to move the shutter from open to closed since it sits mostly flush with the top bezel along the display, but that's a good thing. It also makes it harder for the shutter to move from covered to uncovered unexpectedly. A visible red dot signals when the webcam is blocked by the shutter, so you'll always know when it can and cannot see you.

Lenovo offers an IR camera as an optional feature for the X1 Carbon, but a shutter isn't available on those models. It's unfortunate that you can't have a model with both, but it's an understandable sacrifice. IR camera setups take up more space than regular webcams, making it more difficult to install a shutter that covers both the webcam and the IR camera. I always appreciate more biometric login options, but I'd make do with the fingerprint sensor only on the X1 Carbon. I often cover my webcams with tape, so having a built-in shutter that adds privacy and prevents my laptop from looking like a sad, bandaged device outweighs the use of an IR camera in this case.



from Hacker News https://ift.tt/YV9WJO
via IFTTT

The Simple Algorithm That Ants Use to Build Bridges

https://ift.tt/2GlKZmk


Army ants form colonies of millions yet have no permanent home. They march through the jungle each night in search of new foraging ground. Along the way they perform logistical feats that would make a four-star general proud, including building bridges with their own bodies.

Much like the swarms of cheap, dumb robots that I explored in my recent article, army ants manage this coordination with no leader and with minimal cognitive resources. An individual army ant is practically blind and has a minuscule brain that couldn’t begin to fathom their elaborate collective movement. “There is no leader, no architect ant saying ‘we need to build here,’” said Simon Garnier, director of the Swarm Lab at the New Jersey Institute of Technology and co-author of a new study that predicts when an army ant colony will decide to build a bridge.

Garnier’s study helps to explain not only how unorganized ants build bridges, but also how they pull off the even more complex task of determining which bridges are worth building at all.

VIDEO

To see how this unfolds, take the perspective of an ant on the march. When it comes to a gap in its path, it slows down. The rest of the colony, still barreling along at 12 centimeters per second, comes trampling over its back. At this point, two simple rules kick in.

The first tells the ant that when it feels other ants walking on its back, it should freeze. “As long as someone walks over you, you stay put,” Garnier said.

This same process repeats in the other ants: They step over the first ant, but—uh-oh—the gap is still there, so the next ant in line slows, gets trampled and freezes in place. In this way, the ants build a bridge long enough to span whatever gap is in front of them. The trailing ants in the colony then walk over it.

There’s more to it than that, though. Bridges involve trade-offs. Imagine a colony of ants comes to a V-shaped gap in its path. The colony doesn’t want to go all the way around the gap—that would take too long—but it also doesn’t build a bridge across the widest part of the gap that would minimize how far the colony has to travel. The fact that army ants don’t always build the distance-minimizing bridge suggests there’s some other factor in their unconscious calculation.

VIDEO

“In ecology when you see something like this, it usually means there’s a cost-benefit trade-off,” Garnier said. “You try to understand: What is the benefit, and what is the cost?”

The cost, ecologists think, is that ants trapped in bridges aren’t available for other tasks, like foraging. At any time on a march, a colony might be maintaining 40 to 50 bridges, with as few as one and as many as 50 ants per bridge. In a 2015 paper, Garnier and his colleagues calculated that as much as 20 percent of the colony can be locked into bridges at a time. At this point, a shorter route just isn’t worth the extra ants it would take to create a longer bridge.

Except, of course, individual ants have no idea how many of their colony-mates are holding fast over a gap. And this is where the second rule kicks in. As individual ants run the “bridging” algorithm, they have a sensitivity to being stampeded. When traffic over their backs is above a certain level, they hold in place, but when it dips below some threshold—perhaps because too many other ants are now occupied in bridge-building themselves—the ant unfreezes and rejoins the march.

This new paper grew out of experiments conducted with army ants in the Panamanian jungle in 2014. Based on those observations, the researchers have created a model that quantifies ants’ sensitivity to foot traffic and predicts when a colony will bridge an obstacle and when it will decide, in a sense, that it’s better to go around.

“We’re trying to figure out if we can predict how much shortcutting ants will do given a geometry of their environment,” Garnier said.

Evolution has seemingly equipped army ants with just the right algorithm for on-the-go bridge building. Researchers working to build swarms of simple robots are still searching for the instructions that will allow their cheap machines to perform similar feats. One challenge they have to contend with is that nature makes ants more reliably, and at lower cost, than humans can fabricate swarm-bots, whose batteries tend to die. A second is that it’s very possible there’s more governing army ant behavior than two simple rules.

“We describe army ants as simple, but we don’t even understand what they’re doing. Yes, they’re simple, but maybe they’re not as simple as people think,” said Melvin Gauci, a researcher at Harvard University working on swarm robotics.



Lead image courtesy of Vaishakh Manohar.

Reprinted with permission from Quanta Magazine's Abstractions blog.



from Hacker News https://ift.tt/YV9WJO
via IFTTT

Udacity announces School of AI with 4 new nanodegrees and 3D simulator

https://ift.tt/2GBqjdr


Online learning platform Udacity today announced plans to launch Universe, a 3D simulator for the makers of autonomous vehicles, as well as the opening of its first-ever School of AI to supply educational courses necessary for people to find jobs that require artificial intelligence knowledge. For users in China, Udacity also launched a WeChat app builder nanodegree today in partnership with Tencent, its first offering for chat app developers.

The series of announcement were made today at Udacity Intersect, an annual conference organized by the online learning company being held at the Computer History Museum in Mountain View, California.

The new and existing AI offerings together is Udacity’s attempt to make a comprehensive set of choices for those who wish to become AI practitioners. To make the School of AI, the company launched new courses for computer vision, natural language processing, and AI programming with Python. A reinforcement learning nanodegree will launch later this year. The new nanodegrees join a series of other AI-related courses like those for self-driving cars, deep learning, or autonomous flight.

To fuel its growth, Udacity VP Christian Plagemann told VentureBeat in an interview the School of AI will receive additional funding and staff resources. Making a School of AI sends a signal to the world and Udacity itself about the importance of AI, Plagemann said.

“We basically create the learning path that leads you into different jobs and professions that have an AI focus so that we can basically span the full spectrum of education, starting from the very beginning, where you learn programming for AI, to the very advanced topics, like deep reinforcement learning. And that means we have a dedicated team staffed behind this,” he said.

With the exception of the reinforcement learning course which will be made available later this year at a date yet to be determined, each of the new AI courses launch for the first time this spring and last two to three months.

In 2014, Udacity began to partner with industry leaders to create nanodegree certifications designed to help teach people the skills necessary to enter transformative, growing fields in the tech industry.

Each nanodegree includes instruction in how to use significant developer platforms in their field. The computer vision nanodegree was created together with Affectiva, which last week introduced its emotion tracking for autonomous vehicle service, and Nvidia, whose expertise is also utilized in the robotics engineer nanodegree. The natural language processing nanodegree includes participation from Amazon’s Alexa.

Whether or not you’re convinced the School of AI is anything more than a series of nanodegree courses, Udacity has steadily built up its AI offerings over the years, starting in 2011 with a popular intro to artificial intelligence course. Overall, Udacity has seen more than 8,000 people graduate from its AI nanodegree programs.

Also announced today, Udacity will debut Universe, a 3D simulator that lives in the cloud and helps autonomous vehicle makers and city designers to play out various scenarios. The simulator is designed to train students in how to write code to accomplish tasks and collaborate, as well as how to manage, build, and analyze data from self-driving cars or autonomous flying vehicles.

“What’s really important for real-world applications is the system aspect, like how do you coordinate the hundreds of thousands of vehicles in a traffic network. And with Udacity Universe, we’re basically making the big investment to build an interactive, real-time, 3D-visualized environment where basically students can learn how to build these systems that work in a safe, reliable, efficient way,” Plagemann said.

The WeChat Mini-Program Development nanodegree will be sponsored with a 1 million RMB scholarship fund. WeChat was chosen as the first chat app developer offering because it has nearly one billion monthly active users, and because of Udacity’s desire to build relationships in China. Udacity first began to offer courses for Chinese users in 2016.



from VentureBeat https://venturebeat.com
via IFTTT