{ "cells": [ { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "from dotenv import load_dotenv\n", "load_dotenv()\n", "import os \n", "\n", "api_key = os.environ.get('GOOGLE_API_KEY')" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "import google.generativeai as genai\n", "genai.configure(api_key = api_key)" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "Model = genai.GenerativeModel(model_name=\"models/gemini-1.5-pro\")\n", "\n", "file = genai.upload_file(\"video.mp4\")" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "response = Model.generate_content([\"Tell me the summury of this video\",file])" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'This video explains linear regression, a statistical technique used to model the relationship between an output variable and one or more input variables. In simpler terms, this means fitting a line through data points and making predictions using that line. The formula for this is y equals mx + b, where y is the output variable, also called the dependent variable. The x is the input variable, called the independent variable. The m and b variables are the coefficients that are solved for in linear regression. The m variable controls the slope of the line. The b variable controls the intercept of the line. These are also referred to as beta1 and beta0. This equation can also have multiple input variables x1, x2, and x3.\\n\\nThe video also explains how to find the best fit for the regression line using residuals or the differences between the data points and the line. Squaring the residuals, then totaling these squares for a given line will get the sum of squared error (SSE). The beta coefficients that minimize the SSE are the most appropriate for the data.\\n\\nTo validate the regression, machine learning practitioners often divide the data into a training set and a test set. They use the training set to fit the regression line, then use the test set to validate the line. They use the r-squared, standard error, prediction intervals, and statistical significance metrics to evaluate the regression.'" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.text" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "This video explains linear regression, a statistical technique used to model the relationship between an output variable and one or more input variables. In simpler terms, this means fitting a line through data points and making predictions using that line. The formula for this is y equals mx + b, where y is the output variable, also called the dependent variable. The x is the input variable, called the independent variable. The m and b variables are the coefficients that are solved for in linear regression. The m variable controls the slope of the line. The b variable controls the intercept of the line. These are also referred to as beta1 and beta0. This equation can also have multiple input variables x1, x2, and x3.\n", "\n", "The video also explains how to find the best fit for the regression line using residuals or the differences between the data points and the line. Squaring the residuals, then totaling these squares for a given line will get the sum of squared error (SSE). The beta coefficients that minimize the SSE are the most appropriate for the data.\n", "\n", "To validate the regression, machine learning practitioners often divide the data into a training set and a test set. They use the training set to fit the regression line, then use the test set to validate the line. They use the r-squared, standard error, prediction intervals, and statistical significance metrics to evaluate the regression." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from IPython.display import Markdown\n", "display(Markdown(response.text))" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "response = Model.generate_content([\"what is the equations provided in the video\",file])" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'The narrator in this video describes the basic process of using linear regression, a type of statistical modeling that assumes a linear relationship between variables. In the equation, the output or dependent variable y can be expressed as a function of an input or independent variable, such as x, or as several input variables, x1, x2, x3, etc. He shows the two main ways these equations are generally expressed:\\n\\ny=mx+b\\nf(x) = mx + b\\ny = β1x + β0\\ny = β2x2 + β1x1 + β0\\ny = β3x3 + β2x2 + β1x1 + β0\\ny = β4x4 + β3x3 + β2x2 + β1x1 + β0\\ny = β5x5 + β4x4 + β3x3 + β2x2 + β1x1 + β0\\n\\n\\n'" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "response.text" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "The narrator in this video describes the basic process of using linear regression, a type of statistical modeling that assumes a linear relationship between variables. In the equation, the output or dependent variable y can be expressed as a function of an input or independent variable, such as x, or as several input variables, x1, x2, x3, etc. He shows the two main ways these equations are generally expressed:\n", "\n", "y=mx+b\n", "f(x) = mx + b\n", "y = β1x + β0\n", "y = β2x2 + β1x1 + β0\n", "y = β3x3 + β2x2 + β1x1 + β0\n", "y = β4x4 + β3x3 + β2x2 + β1x1 + β0\n", "y = β5x5 + β4x4 + β3x3 + β2x2 + β1x1 + β0\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "display(Markdown(response.text))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.0" } }, "nbformat": 4, "nbformat_minor": 2 }