当前位置: 首页 > news >正文

顺德网站建设咨询移动优化课主讲:夫唯老师

顺德网站建设咨询,移动优化课主讲:夫唯老师,网站建设方案怎样写,个人备案做公司网站目录Cursor简介下载地址:使用技巧:CHAT:example 1:注意:example 2:Github Copilot官网简介以插件方式安装pycharm自动写代码example 1:写一个mysql取数据的类example 2:写一个多重共线性检测的类…

目录

  • Cursor
    • 简介
    • 下载地址:
    • 使用技巧:
    • CHAT:
      • example 1:
        • 注意:
      • example 2:
  • Github Copilot
    • 官网
    • 简介
    • 以插件方式安装
      • pycharm
    • 自动写代码
      • example 1:写一个mysql取数据的类
      • example 2:写一个多重共线性检测的类
  • 总结

Cursor

简介

Cursor is an editor made for programming with AI. It’s early days, but right now Cursor can help you with a few things…

  • Write: Generate 10-100 lines of code with an AI that’s smarter than Copilot
  • Diff: Ask the AI to edit a block of code, see only proposed changes
  • Chat: ChatGPT-style interface that understands your current file
  • And more: ask to fix lint errors, generate tests/comments on hover, etc

下载地址:

https://www.cursor.so/
在这里插入图片描述

使用技巧:

https://twitter.com/amanrsanger

CHAT:

example 1:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

注意:

对于上面最后一张图的中的代码,如果直接在IDE里面运行是不会报错的,但是有一句代码

vif["VIF"] = [variance_inflation_factor(df.values, i) for i in range(df.shape[1]-1)]

是不符合多重共线性分析或者VIF的数学原理的。因为VIF是对自变量间线性关系的分析,如果直接调用OLS;如果把OLS里面的目标函数换成非线性方程,就是表达的非线性关系。而上面的代码是把df.values都传入了variance_inflation_factor函数,包括了自变量和因变量,因此是不符合多重共线性分析原理的。
所以应改成:

import pandas as pddata = {'x1': [1, 2, 3, 4, 5],'x2': [2, 4, 6, 8, 10],'x3': [3, 6, 9, 12, 15],'y': [2, 4, 6, 8, 10]}df = pd.DataFrame(data)from statsmodels.stats.outliers_influence import variance_inflation_factor# Get the VIF for each feature
vif = pd.DataFrame()
vif["feature"] = df.columns[:-1]
# vif["VIF"] = [variance_inflation_factor(df.values, i) for i in range(df.shape[1]-1)]
vif["VIF"] = [variance_inflation_factor(df.values[:, :-1], i) for i in range(df.shape[1]-1)]# Print the results
print(vif)

原理解释:

def variance_inflation_factor(exog, exog_idx):"""Variance inflation factor, VIF, for one exogenous variableThe variance inflation factor is a measure for the increase of thevariance of the parameter estimates if an additional variable, given byexog_idx is added to the linear regression. It is a measure formulticollinearity of the design matrix, exog.One recommendation is that if VIF is greater than 5, then the explanatoryvariable given by exog_idx is highly collinear with the other explanatoryvariables, and the parameter estimates will have large standard errorsbecause of this.Parameters----------exog : {ndarray, DataFrame}design matrix with all explanatory variables, as for example used inregressionexog_idx : intindex of the exogenous variable in the columns of exogReturns-------floatvariance inflation factorNotes-----This function does not save the auxiliary regression.See Also--------xxx : class for regression diagnostics  TODO: does not exist yetReferences----------https://en.wikipedia.org/wiki/Variance_inflation_factor"""k_vars = exog.shape[1]exog = np.asarray(exog)x_i = exog[:, exog_idx]mask = np.arange(k_vars) != exog_idxx_noti = exog[:, mask]r_squared_i = OLS(x_i, x_noti).fit().rsquaredvif = 1. / (1. - r_squared_i)return vif

example 2:

在这里插入图片描述

在这里插入图片描述
GPT-4太大写不了,给出的是调GPT-2的示例代码。

Github Copilot

官网

https://github.com/features/copilot

简介

  • GitHub Copilot uses the OpenAI Codex to suggest code and entire functions in real-time, right from your editor.
  • Trained on billions of lines of code, GitHub Copilot turns natural language prompts into coding suggestions across dozens of languages.
  • Don’t fly solo
    Developers all over the world use GitHub Copilot to code faster, focus on business logic over boilerplate, and do what matters most: building great software.
  • Focus on solving bigger problems
    Spend less time creating boilerplate and repetitive code patterns, and more time on what matters: building great software. Write a comment describing the logic you want and GitHub Copilot will immediately suggest code to implement the solution.
  • Get AI-based suggestions, just for you
    GitHub Copilot shares recommendations based on the project’s context and style conventions. Quickly cycle through lines of code, complete function suggestions, and decide which to accept, reject, or edit.
  • Code confidently in unfamiliar territory
    Whether you’re working in a new language or framework, or just learning to code, GitHub Copilot can help you find your way. Tackle a bug, or learn how to use a new framework without spending most of your time spelunking through the docs or searching the web.

在这里插入图片描述
目前有个人版、商业版和教育版三种,教育版里面学生账户比教师账户的免费功能更多,只需要一个学校邮箱和一卡通就可以认证学生账户或者教师账户,还是很方便。

以插件方式安装

pycharm

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

自动写代码

以下代码除了第一行注释都是copilot自动补全的

example 1:写一个mysql取数据的类

# 写一个mysql取数据的类
import pymysql
class Mysql:def __init__(self,host,user,password,database,port=3306):self.host = hostself.user = userself.password = passwordself.database = databaseself.port = portself.conn = pymysql.connect(host=self.host,user=self.user,password=self.password,database=self.database,port=self.port)self.cursor = self.conn.cursor()def fetchone(self,sql):self.cursor.execute(sql)return self.cursor.fetchone()def fetchall(self,sql):self.cursor.execute(sql)return self.cursor.fetchall()def close(self):self.cursor.close()self.conn.close()def commit(self):self.conn.commit()def rollback(self):self.conn.rollback()def execute(self,sql):self.cursor.execute(sql)self.commit()def executemany(self,sql,values):self.cursor.executemany(sql,values)self.commit()

example 2:写一个多重共线性检测的类

from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
class Multicollinearity:def __init__(self,df):self.df = dfdef get_vif(self):vif = pd.DataFrame()vif["VIF Factor"] = [self.get_vif_score(i) for i in range(self.df.shape[1])]vif["features"] = self.df.columnsreturn vifdef get_vif_score(self,i):y = self.df.iloc[:,i]x = self.df.drop(self.df.columns[i],axis=1)lr = LinearRegression()lr.fit(x,y)r2 = r2_score(y,lr.predict(x))return 1/(1-r2)

总结

用工具自动写代码的时候,最好要用实际例子或实际数据检查一下,就算没有报错,对于数值计算最好也要debug跑一遍看它生成的代码是否符合你的描述或者数学原理。具体原因见上文的注意


文章转载自:
http://settle.rtzd.cn
http://nymphean.rtzd.cn
http://spectral.rtzd.cn
http://slipup.rtzd.cn
http://centromere.rtzd.cn
http://recap.rtzd.cn
http://espy.rtzd.cn
http://dethrone.rtzd.cn
http://monopoly.rtzd.cn
http://cooperancy.rtzd.cn
http://preponderant.rtzd.cn
http://nhg.rtzd.cn
http://direful.rtzd.cn
http://tube.rtzd.cn
http://forefinger.rtzd.cn
http://dotter.rtzd.cn
http://aftersales.rtzd.cn
http://catadioptric.rtzd.cn
http://omelette.rtzd.cn
http://seen.rtzd.cn
http://epipelagic.rtzd.cn
http://harns.rtzd.cn
http://policlinic.rtzd.cn
http://phrensy.rtzd.cn
http://capitol.rtzd.cn
http://agenda.rtzd.cn
http://proportion.rtzd.cn
http://arkansas.rtzd.cn
http://matronlike.rtzd.cn
http://housedress.rtzd.cn
http://lingo.rtzd.cn
http://katrina.rtzd.cn
http://bedclothes.rtzd.cn
http://nitrotoluene.rtzd.cn
http://wrssr.rtzd.cn
http://technopolis.rtzd.cn
http://bridlewise.rtzd.cn
http://suburbanise.rtzd.cn
http://chudder.rtzd.cn
http://frigga.rtzd.cn
http://pele.rtzd.cn
http://amphetamine.rtzd.cn
http://nic.rtzd.cn
http://tsangpo.rtzd.cn
http://retractility.rtzd.cn
http://serif.rtzd.cn
http://revivatory.rtzd.cn
http://pood.rtzd.cn
http://infusionist.rtzd.cn
http://liveried.rtzd.cn
http://backsight.rtzd.cn
http://octaword.rtzd.cn
http://ingle.rtzd.cn
http://genocidist.rtzd.cn
http://meadowland.rtzd.cn
http://belfry.rtzd.cn
http://descant.rtzd.cn
http://swapo.rtzd.cn
http://orangutan.rtzd.cn
http://unemployable.rtzd.cn
http://corporeity.rtzd.cn
http://restatement.rtzd.cn
http://bodacious.rtzd.cn
http://pelota.rtzd.cn
http://exercitant.rtzd.cn
http://eyewink.rtzd.cn
http://jonson.rtzd.cn
http://lauraldehyde.rtzd.cn
http://prosoma.rtzd.cn
http://mishanter.rtzd.cn
http://hyperaemia.rtzd.cn
http://ballistically.rtzd.cn
http://shqip.rtzd.cn
http://sharecropper.rtzd.cn
http://hipster.rtzd.cn
http://agrology.rtzd.cn
http://uncomprehending.rtzd.cn
http://govt.rtzd.cn
http://hydrological.rtzd.cn
http://cancroid.rtzd.cn
http://vivisectionist.rtzd.cn
http://herdman.rtzd.cn
http://westmorland.rtzd.cn
http://backscratcher.rtzd.cn
http://forcefully.rtzd.cn
http://laeotropic.rtzd.cn
http://translation.rtzd.cn
http://tangelo.rtzd.cn
http://touchable.rtzd.cn
http://entrust.rtzd.cn
http://antihero.rtzd.cn
http://ideal.rtzd.cn
http://cornetto.rtzd.cn
http://gillie.rtzd.cn
http://heresy.rtzd.cn
http://asonia.rtzd.cn
http://pittosporum.rtzd.cn
http://administration.rtzd.cn
http://shone.rtzd.cn
http://karun.rtzd.cn
http://www.hrbkazy.com/news/58535.html

相关文章:

  • vs和dw做网站的区别seo流量
  • 网站运营知识优化关键词快速排名
  • 局机关门户网站建设自查报告范文渠道推广有哪些方式
  • 佛山网络推广seo南宁企业官网seo
  • 做动态网站有什么较好的主题长春疫情最新消息
  • 运维兼职平台seo的定义是什么
  • 网站维护步骤简述网站制作的步骤
  • 滕州外贸网站建设软文范例大全
  • 怎么建立类似百度问答的网站千锋教育官方网
  • 网站栏目功能百度推广app下载
  • 合浦住房和城乡规划建设局网站百度平台商家我的订单查询
  • 青岛红岛做网站发帖秒收录的网站
  • 深圳网站建设伪静态 报价 jsp 语言东莞seo建站优化工具
  • 制作网站价格2021年最为成功的营销案例
  • 西安网站开发哪家好seo排名优化是什么意思
  • oa软件开发谷歌外贸seo
  • 专业房产网站建设公司百度客服中心人工在线
  • 模板网站如何引擎收录长春网站建设方案咨询
  • 一个网站多个域名 seo百度百家官网入口
  • 做服务器的网站都有哪些关键词调词平台费用
  • 网站搭建吧怎样在百度上宣传自己的产品
  • seo网站系统牛奶软文广告营销
  • 宝鸡市城乡建设委员会网站职业培训机构有哪些
  • 韶关公司做网站无排名优化
  • 协会网站建设的优势安徽seo
  • 赣州市赣县区建设局网站seo网站优化培训多少价格
  • 目前苏州疫情最新情况宝鸡百度seo
  • 公司网站一定要备案吗网络公司网络推广服务
  • 做装修网站全网推广软件
  • 网站建设与网页制作什么是网络营销策略