Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions w1/conda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# BasisOfLearning
Week 1

# Working with conda environments

Firstly install anaconda from https://www.anaconda.com/products/distribution#windows

Open a terminal window and type
#### conda --version
Conda displays the number of the version that you have installed.

Update conda to the current version. Type the following:
#### conda update conda

# Managing Environments

Open conda command prompt-

Create a new environment and install a package in it.

We will create a new anaconda package say 'deeplearning'.
Using the following command in conda command promp
#### conda create --name deeplearning

To use, or "activate" the new environment, type the following:
#### conda activate deeplearning

To install package to given environment we will type:

#### conda install -n deeplearning python
41 changes: 41 additions & 0 deletions w1/jupyter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Jupyter Notebook Installation

This page contains information and links about installing and using tools across the Jupyter ecosystem. Generally speaking, the documentation of each tool is the place to learn about the best-practices for how to install and use the tool.

Use the following installation steps:

1.Download Anaconda. We recommend downloading Anaconda’s latest Python 3 version (currently Python 3.9).

2.Install the version of Anaconda which you downloaded, following the instructions on the download page.

3.Congratulations, you have installed Jupyter Notebook. To run the notebook type in conda command prompt:

#### jupyter notebook

or directly use anaconda navigator to access it.

# Creating a new Notebook

A new notebook may be created at any time, either from the dashboard, or using the File → New menu option from
within an active notebook. The new notebook is created within the same directory and will open in a new browser tab.
It will also be reflected as a new entry in the notebook list on the dashboard.

When you create a new notebook document, you will be presented with the notebook name, a menu bar, a toolbar
and an empty code cell.

# Structure of Notebook

The notebook consists of a sequence of cells. A cell is a multiline text input field, and its contents can be executed by
using Shift-Enter, or by clicking either the “Play” button the toolbar, or Cell, Run in the menu bar. The execution
behavior of a cell is determined by the cell’s type. There are three types of cells: code cells, markdown cells, and raw
cells. Every cell starts off being a code cell, but its type can be changed by using a drop-down on the toolbar (which
will be “Code”, initially), or via keyboard shortcuts

# Code Cells

A code cell allows you to edit and write new code, with full syntax highlighting and tab completion. The programming
language you use depends on the kernel, and the default kernel (IPython) runs Python code.
When a code cell is executed, code that it contains is sent to the kernel associated with the notebook. The results that
are returned from this computation are then displayed in the notebook as the cell’s output. The output is not limited to
text, with many other possible forms of output are also possible, including matplotlib figures and HTML tables (as
used, for example, in the pandas data analysis package). This is known as IPython’s rich display capability.
123 changes: 123 additions & 0 deletions w1/matplotlib.ipynb

Large diffs are not rendered by default.

225 changes: 225 additions & 0 deletions w1/numpy.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "6437d32a",
"metadata": {},
"source": [
"NumPy is a Python library used for working with arrays.\n",
"\n",
"It also has functions for working in domain of linear algebra, fourier transform, and matrices.\n",
"\n",
"NumPy was created in 2005 by Travis Oliphant. It is an open source project and you can use it freely.\n",
"\n",
"NumPy stands for Numerical Python."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "d74f7966",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2 3 4]\n"
]
}
],
"source": [
"import numpy as np\n",
"data=np.array([1,2,3,4])\n",
"print(data)"
]
},
{
"cell_type": "markdown",
"id": "89c51eeb",
"metadata": {},
"source": [
"To create an ndarray, we can pass a list,\n",
"tuple or any array-like object into the array() method, and it will be converted into an ndarray"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "566350a7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2\n"
]
}
],
"source": [
"#check dimension of array\n",
"data=np.array([[1,2,3],[1,2,3]])\n",
"print(data.ndim)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "81827eac",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5th element on 2nd row: 10\n"
]
}
],
"source": [
"#accessing array element\n",
"import numpy as np\n",
"\n",
"arr = np.array([[1,2,3,4,5], [6,7,8,9,10]])\n",
"\n",
"print('5th element on 2nd row: ', arr[1, 4])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "6969ec8f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2 3 4 5]\n"
]
}
],
"source": [
"#Slicing Arrays\n",
"import numpy as np\n",
"\n",
"arr = np.array([1, 2, 3, 4, 5, 6, 7])\n",
"\n",
"print(arr[1:5])"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "cd5c2253",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1 2 3]\n",
"int32\n"
]
}
],
"source": [
"#changing data types\n",
"import numpy as np\n",
"\n",
"arr = np.array([1.1, 2.1, 3.1])\n",
"\n",
"newarr = arr.astype('i')\n",
"\n",
"print(newarr)\n",
"print(newarr.dtype)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "f589833c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[42 2 3 4 5]\n",
"[1 2 3 4 5]\n"
]
}
],
"source": [
"#array copy \n",
"#Make a copy, change the original array, and display both arrays:\n",
"import numpy as np\n",
"\n",
"arr = np.array([1, 2, 3, 4, 5])\n",
"x = arr.copy()\n",
"arr[0] = 42\n",
"\n",
"print(arr)\n",
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "ef77a16f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[42 2 3 4 5]\n",
"[42 2 3 4 5]\n"
]
}
],
"source": [
"#array view\n",
"#Make a view, change the original array, and display both arrays:\n",
"import numpy as np\n",
"\n",
"arr = np.array([1, 2, 3, 4, 5])\n",
"x = arr.view()\n",
"arr[0] = 42\n",
"\n",
"print(arr)\n",
"print(x)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fe48d67f",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading