Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Series #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyNGSJJ+iuyj5ZBob0JkgoG6",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/amithbiju/FlutterChatAppTutorial/blob/master/Json/Converting_Python_object_containing_all_the_legal_data_types.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "6LrSXims3jdj",
"outputId": "88eaf273-3b87-4bb0-a59f-599b073b6780"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"{\"name\": \"John\", \"age\": 30, \"married\": true, \"divorced\": false, \"children\": [\"Ann\", \"Billy\"], \"pets\": null, \"cars\": [{\"model\": \"BMW 230\", \"mpg\": 27.5}, {\"model\": \"Ford Edge\", \"mpg\": 24.1}]}\n"
]
}
],
"source": [
"import json\n",
"\n",
"x = {\n",
" \"name\": \"John\",\n",
" \"age\": 30,\n",
" \"married\": True,\n",
" \"divorced\": False,\n",
" \"children\": (\"Ann\",\"Billy\"),\n",
" \"pets\": None,\n",
" \"cars\": [\n",
" {\"model\": \"BMW 230\", \"mpg\": 27.5},\n",
" {\"model\": \"Ford Edge\", \"mpg\": 24.1}\n",
" ]\n",
"}\n",
"\n",
"print(json.dumps(x))\n"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyMt56DabNBLu2zfWbH6oeH9",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/amithbiju/FlutterChatAppTutorial/blob/master/PyTorch_Tensors_to_fit_a_third_order_polynomial_to_sine_function_.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "ntcctNbd5zG8"
},
"outputs": [],
"source": [
"import torch\n",
"import math\n",
"\n",
"\n",
"dtype = torch.float\n",
"device = torch.device(\"cpu\")\n",
"# device = torch.device(\"cuda:0\") # Uncomment this to run on GPU\n",
"\n",
"# Create random input and output data\n",
"x = torch.linspace(-math.pi, math.pi, 2000, device=device, dtype=dtype)\n",
"y = torch.sin(x)\n",
"\n",
"# Randomly initialize weights\n",
"a = torch.randn((), device=device, dtype=dtype)\n",
"b = torch.randn((), device=device, dtype=dtype)\n",
"c = torch.randn((), device=device, dtype=dtype)\n",
"d = torch.randn((), device=device, dtype=dtype)\n",
"\n",
"learning_rate = 1e-6\n",
"for t in range(2000):\n",
" # Forward pass: compute predicted y\n",
" y_pred = a + b * x + c * x ** 2 + d * x ** 3\n",
"\n",
" # Compute and print loss\n",
" loss = (y_pred - y).pow(2).sum().item()\n",
" if t % 100 == 99:\n",
" print(t, loss)\n",
"\n",
" # Backprop to compute gradients of a, b, c, d with respect to loss\n",
" grad_y_pred = 2.0 * (y_pred - y)\n",
" grad_a = grad_y_pred.sum()\n",
" grad_b = (grad_y_pred * x).sum()\n",
" grad_c = (grad_y_pred * x ** 2).sum()\n",
" grad_d = (grad_y_pred * x ** 3).sum()\n",
"\n",
" # Update weights using gradient descent\n",
" a -= learning_rate * grad_a\n",
" b -= learning_rate * grad_b\n",
" c -= learning_rate * grad_c\n",
" d -= learning_rate * grad_d\n",
"\n",
"\n",
"print(f'Result: y = {a.item()} + {b.item()} x + {c.item()} x^2 + {d.item()} x^3')"
]
}
]
}
53 changes: 53 additions & 0 deletions Untitled0.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPc0lLR8A+7DCW7vCUNzoU2",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/amithbiju/FlutterChatAppTutorial/blob/master/Untitled0.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "J25Ag0V0meLA",
"outputId": "6d2d1ddf-096e-4a83-c3d2-7a3bcc98c085"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"amith\n"
]
}
],
"source": [
"print(\"amith\")"
]
}
]
}
82 changes: 82 additions & 0 deletions pandas/Creating_a_Series.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyMyBMyDx1JS0lDsmFXmj/Lp",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/amithbiju/FlutterChatAppTutorial/blob/vr_1/pandas/Creating_a_Series.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "EGmbg4gohOKp",
"outputId": "7a992dd9-2a44-4ac1-f4fb-06a3c5059c28"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: pandas in /usr/local/lib/python3.8/dist-packages (1.3.5)\n",
"Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.8/dist-packages (from pandas) (2022.6)\n",
"Requirement already satisfied: numpy>=1.17.3 in /usr/local/lib/python3.8/dist-packages (from pandas) (1.21.6)\n",
"Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.8/dist-packages (from pandas) (2.8.2)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.8/dist-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)\n"
]
}
],
"source": [
"! pip install pandas"
]
},
{
"cell_type": "code",
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"\n",
"# Creating empty series\n",
"ser = pd.Series()\n",
"\n",
"print(ser)\n",
"\n",
"# simple array\n",
"data = np.array(['g', 'e', 'e', 'k', 's'])\n",
"\n",
"ser = pd.Series(data)\n",
"print(ser)\n"
],
"metadata": {
"id": "gTCNVZiCj31S"
},
"execution_count": null,
"outputs": []
}
]
}
83 changes: 83 additions & 0 deletions skiPy/Double_Integrals.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPoOxZlKRHjQLzp5Z472l3B",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/amithbiju/FlutterChatAppTutorial/blob/master/skiPy/Double_Integrals.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "-yhh9MOSLk0G",
"outputId": "1d7ab912-5f54-4cff-d0bc-952e91bc0923"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
"Requirement already satisfied: scipy in /usr/local/lib/python3.8/dist-packages (1.7.3)\n",
"Requirement already satisfied: numpy<1.23.0,>=1.16.5 in /usr/local/lib/python3.8/dist-packages (from scipy) (1.21.6)\n"
]
}
],
"source": [
"! pip install scipy"
]
},
{
"cell_type": "code",
"source": [
"from scipy import integrate\n",
"import numpy as np\n",
"f = lambda y, x: x*y**2\n",
"i = integrate.dblquad(f, 0, 2, lambda x: 0, lambda x: 1)\n",
"# print the results\n",
"print(i)\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_dSQfyOCMhVw",
"outputId": "223896e0-c130-4152-8333-e0590fcfa02f"
},
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"(0.6666666666666667, 7.401486830834377e-15)\n"
]
}
]
}
]
}