国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

輔助編程coding的兩種工具:Github Copilot、Cursor

這篇具有很好參考價(jià)值的文章主要介紹了輔助編程coding的兩種工具:Github Copilot、Cursor。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

Cursor

簡(jiǎn)介

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/
輔助編程coding的兩種工具:Github Copilot、Cursor

使用技巧:

https://twitter.com/amanrsanger

CHAT:

example 1:

輔助編程coding的兩種工具:Github Copilot、Cursor
輔助編程coding的兩種工具:Github Copilot、Cursor
輔助編程coding的兩種工具:Github Copilot、Cursor
輔助編程coding的兩種工具:Github Copilot、Cursor
輔助編程coding的兩種工具:Github Copilot、Cursor

注意:

對(duì)于上面最后一張圖的中的代碼,如果直接在IDE里面運(yùn)行是不會(huì)報(bào)錯(cuò)的,但是有一句代碼

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

是不符合多重共線性分析或者VIF的數(shù)學(xué)原理的。因?yàn)閂IF是對(duì)自變量間線性關(guān)系的分析,如果直接調(diào)用OLS;如果把OLS里面的目標(biāo)函數(shù)換成非線性方程,就是表達(dá)的非線性關(guān)系。而上面的代碼是把df.values都傳入了variance_inflation_factor函數(shù),包括了自變量和因變量,因此是不符合多重共線性分析原理的。
所以應(yīng)改成:

import pandas as pd

data = {'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 variable

    The variance inflation factor is a measure for the increase of the
    variance of the parameter estimates if an additional variable, given by
    exog_idx is added to the linear regression. It is a measure for
    multicollinearity of the design matrix, exog.

    One recommendation is that if VIF is greater than 5, then the explanatory
    variable given by exog_idx is highly collinear with the other explanatory
    variables, and the parameter estimates will have large standard errors
    because of this.

    Parameters
    ----------
    exog : {ndarray, DataFrame}
        design matrix with all explanatory variables, as for example used in
        regression
    exog_idx : int
        index of the exogenous variable in the columns of exog

    Returns
    -------
    float
        variance inflation factor

    Notes
    -----
    This function does not save the auxiliary regression.

    See Also
    --------
    xxx : class for regression diagnostics  TODO: does not exist yet

    References
    ----------
    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_idx
    x_noti = exog[:, mask]
    r_squared_i = OLS(x_i, x_noti).fit().rsquared
    vif = 1. / (1. - r_squared_i)
    return vif

example 2:

輔助編程coding的兩種工具:Github Copilot、Cursor

輔助編程coding的兩種工具:Github Copilot、Cursor
GPT-4太大寫不了,給出的是調(diào)GPT-2的示例代碼。

Github Copilot

官網(wǎng)

https://github.com/features/copilot

簡(jiǎn)介

  • 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.

輔助編程coding的兩種工具:Github Copilot、Cursor
目前有個(gè)人版、商業(yè)版和教育版三種,教育版里面學(xué)生賬戶比教師賬戶的免費(fèi)功能更多,只需要一個(gè)學(xué)校郵箱和一卡通就可以認(rèn)證學(xué)生賬戶或者教師賬戶,還是很方便。

以插件方式安裝

pycharm

輔助編程coding的兩種工具:Github Copilot、Cursor
輔助編程coding的兩種工具:Github Copilot、Cursor
輔助編程coding的兩種工具:Github Copilot、Cursor

自動(dòng)寫代碼

以下代碼除了第一行注釋都是copilot自動(dòng)補(bǔ)全的

example 1:寫一個(gè)mysql取數(shù)據(jù)的類

# 寫一個(gè)mysql取數(shù)據(jù)的類
import pymysql
class Mysql:
    def __init__(self,host,user,password,database,port=3306):
        self.host = host
        self.user = user
        self.password = password
        self.database = database
        self.port = port
        self.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:寫一個(gè)多重共線性檢測(cè)的類

from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
class Multicollinearity:
    def __init__(self,df):
        self.df = df
    def 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.columns
        return vif
    def 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)

總結(jié)

用工具自動(dòng)寫代碼的時(shí)候,最好要用實(shí)際例子或?qū)嶋H數(shù)據(jù)檢查一下,就算沒(méi)有報(bào)錯(cuò),對(duì)于數(shù)值計(jì)算最好也要debug跑一遍看它生成的代碼是否符合你的描述或者數(shù)學(xué)原理。具體原因見(jiàn)上文的注意。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-422730.html

到了這里,關(guān)于輔助編程coding的兩種工具:Github Copilot、Cursor的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • CodeGeeX、CodeWhisperer、Github Copilot三款A(yù)I輔助編程工具,程序員該如何選擇?

    亞馬遜今天在Re:Mars大會(huì)上宣布推出CodeWhisperer,這是一款類似于 CodeGeeX 和GitHub Copilot的AI輔助編程工具,它根據(jù)一個(gè)注釋或幾個(gè)按鍵來(lái)自動(dòng)補(bǔ)全整個(gè)函數(shù)。目前支持Java、JavaScript和Python,和 CodeGeeX 一樣,使用了數(shù)十億行公開(kāi)可用的開(kāi)源代碼、自己的代碼庫(kù)、公開(kāi)可用的文檔和公

    2023年04月16日
    瀏覽(30)
  • AI輔助編程,GitHub copilot chat 體驗(yàn)

    AI輔助編程,GitHub copilot chat 體驗(yàn)

    最近,看到很多大佬分享 GitHub copilot chat ,據(jù)說(shuō)能夠讓效率翻倍,抱著不相信,打假的心態(tài)我也弄一個(gè),體驗(yàn)一下,結(jié)果真的很贊,下面分享使用 GitHub copilot chat 的過(guò)程 ? 首先,我們需要先了解一下 GitHub copilot chat 是一個(gè)什么東西,GitHub Copilot 是一個(gè)AI驅(qū)動(dòng)的代碼完成工具,

    2024年02月17日
    瀏覽(31)
  • AI 輔助編程工具,會(huì)編程和不會(huì)編程的人都需要!附Cursor 保姆級(jí)使用教程

    AI 輔助編程工具,會(huì)編程和不會(huì)編程的人都需要!附Cursor 保姆級(jí)使用教程

    ? 我是卷了又沒(méi)卷,薛定諤的卷的AI算法工程師「陳城南」。 自 AI 技術(shù)被應(yīng)用到輔助編程工具中后,編程的門檻被大幅降低,會(huì)編程和不會(huì)編程的人都需要得接觸一下來(lái)提高自己的日常生產(chǎn)力! 程序員群體 可以通過(guò) AI 編程助手大幅提高自己的工作效率,編寫重復(fù)且低效的代

    2024年02月06日
    瀏覽(22)
  • 探索編程新紀(jì)元:Code GeeX、Copilot與通義靈碼的智能輔助之旅

    探索編程新紀(jì)元:Code GeeX、Copilot與通義靈碼的智能輔助之旅

    在人工智能技術(shù)日新月異的今天,編程領(lǐng)域的革新也正以前所未有的速度推進(jìn)。新一代的編程輔助工具,如Code GeeX、Copilot和通義靈碼,正在重塑開(kāi)發(fā)者的工作流程,提升編程效率,并推動(dòng)編程教育的普及。本文將深入探討這三款工具的特點(diǎn)、優(yōu)勢(shì)與局限,為開(kāi)發(fā)者提供一份詳

    2024年03月17日
    瀏覽(38)
  • 【AGI】Copilot AI編程輔助工具安裝教程

    【AGI】Copilot AI編程輔助工具安裝教程

    1. 基礎(chǔ)激活教程 GitHub和OpenAI聯(lián)合為程序員們送上了編程神器——GitHub Copilot。 但是,Copilot目前不提供公開(kāi)使用,需要注冊(cè)賬號(hào)通過(guò)審核,我也提交了申請(qǐng):這里第一期記錄下,開(kāi)啟教程,歡迎大佬們來(lái)討論交流。 第一步:Github開(kāi)啟copilot權(quán)限(已開(kāi)啟的 請(qǐng)忽略此步) copilo

    2024年02月13日
    瀏覽(31)
  • ChatGPT4.0知識(shí)問(wèn)答、DALL-E生成AI圖片、Code Copilot輔助編程,打開(kāi)新世界的大門

    ChatGPT4.0知識(shí)問(wèn)答、DALL-E生成AI圖片、Code Copilot輔助編程,打開(kāi)新世界的大門

    支持在線修改和圖片導(dǎo)出。走一個(gè)~ (1)畫一個(gè)會(huì)飛的豬 (2)通過(guò)選擇select,對(duì)會(huì)飛的豬進(jìn)行潤(rùn)色 (3)畫一個(gè)花色翅膀 (4)來(lái)一個(gè)難的,根據(jù)斗羅大陸的設(shè)定,添加一個(gè)十萬(wàn)年魂環(huán),哈哈 我記得金色魂環(huán)是百萬(wàn)年的了,哈哈。不過(guò)還可以理解。 (5)根據(jù)斗羅大陸的設(shè)計(jì)

    2024年04月29日
    瀏覽(22)
  • 如何在VS Code中運(yùn)用GitHub Copilot提高編程效率

    如何在VS Code中運(yùn)用GitHub Copilot提高編程效率

    本文首發(fā)于公眾號(hào):更AI (power_ai),歡迎關(guān)注,編程、AI干貨及時(shí)送! GitHub Copilot是一個(gè)AI配對(duì)編程工具。這是一個(gè)花哨的說(shuō)法,稱它為\\\"第二程序員\\\",它在你的源代碼編輯器內(nèi)部工作。在你編寫代碼時(shí),Copilot會(huì)以自動(dòng)完成的方式給出建議,幫助你更快、更有效地編寫代碼。 本文

    2024年02月16日
    瀏覽(40)
  • AI代碼輔助工具codeium,替代 codota 或Tabnie ,或github收費(fèi)的 copilot

    AI代碼輔助工具codeium,替代 codota 或Tabnie ,或github收費(fèi)的 copilot

    官網(wǎng)例子-安裝登錄和使用 能學(xué)習(xí)你的代碼,給出你自己已寫過(guò)的老代碼提示,減少很多 復(fù)制粘貼工作 對(duì)python 的支持很好,比如 輸入 def fib(n): ,即可一直 tab 生成 完整的代碼 我嘗試在java 中的注釋部分,生成如上代碼,ok 嘗試直接在java 定義fib 函數(shù),不知道怎么弄,失敗

    2023年04月22日
    瀏覽(25)
  • 測(cè)試了Copilot輔助編程后,就離不開(kāi)這個(gè)AI工具了

    測(cè)試了Copilot輔助編程后,就離不開(kāi)這個(gè)AI工具了

    微軟用·chatGPT 4· 對(duì)·github copilot X·升級(jí)后,本是懷著贈(zèng)熱點(diǎn)的心態(tài)測(cè)試了一下其功能。但 Copilot 智能化程度之高,令我吃驚,兩周下來(lái)已離開(kāi)不這個(gè)工具了。 下面簡(jiǎn)單分享一下其使用過(guò)程,以及對(duì)如何使用好這個(gè)工具的個(gè)人看法. IDE開(kāi)發(fā)環(huán)境我使用的是 VSCode 與 Visual Studio2

    2024年02月06日
    瀏覽(30)
  • 倚天屠龍:Github Copilot vs Cursor

    倚天屠龍:Github Copilot vs Cursor

    武林至尊,寶刀屠龍。號(hào)令天下,莫敢不從。倚天不出,誰(shuí)與爭(zhēng)鋒! 作為開(kāi)發(fā)人員吃飯的家伙,一款好的開(kāi)發(fā)工具對(duì)開(kāi)發(fā)人員的幫助是無(wú)法估量的。還記得在學(xué)校讀書(shū)的時(shí)候,當(dāng)時(shí)流行CS架構(gòu)的RAD,Delphi和VisualBasic大行其道。就因?yàn)镈elphi開(kāi)發(fā)快,即使原來(lái)沒(méi)學(xué)過(guò)Pascal(當(dāng)時(shí)都

    2024年02月05日
    瀏覽(22)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包