18 things I did with ChatGPT! [Founder of Artificial Intelligence Chinese Station: Mydear Wheat Field Interview]

Created a new website

https://ai.weoknow.com/

Update the available domestic chatGPT for everyone every day

Are you sure you can use ChatGPT?
Today I compiled 18 ways to use ChatGPT, let everyone see which ones you can use.
1. Grammar Correction
2. Text Translation
3. Language Switching
4. Code Interpretation
5. Fixing Code Errors
6. Acting as an Encyclopedia
7. Information Extraction
8. Friends Chat 9.
Idea Generator
10. Interview Questions
11. Essay Outline
12. Stories Creation
13. Problem analogy
14. Create SQL requirements
15. Sentiment analysis
16. Convert product description into advertisement
17. Keyword extraction
18. Chatbot


1. Grammar Correction
Uses: Polishing items, paper, etc.

2. Text translation

Purpose: Daily study of business translation, etc.

3. Language switching

Python–>JAVA
purpose: work purpose, cooperation between engineers of different languages, more convenient.

import numpy as np
import plotly.express as px

def thresholding_algo(y, lag, threshold):
    """
    :param y: 输入列表
    :param lag: 滑动窗口大小
    :param threshold: 调节系数,用于调节容忍范围的大小。
    :return:
    """
    # signals:信号列表
    signals = np.zeros(len(y))
    avgFilter = np.zeros(len(y))

    # 初始化平均值列表、差值列表
    avgFilter[lag - 1] = np.mean(y[0:lag])
    dif_li = [0] * len(y)

    for i in range(lag, len(y)):
        if i < len(y) - lag - 30:
            for j in range(i + 11, len(y)):
                if y[j] >= y[i - 1]:
                    break
            if j >= len(y) - 30:
                back = y[i - 1]
            else:
                back = np.mean(y[j + 11:j + 20 + lag])
        else:
            back = y[i - 1]

        # 前后均值差值计算
        tmp = abs(back - avgFilter[i - 1])
        dif = (tmp if tmp > 1 else 1)

        if abs(y[i] - avgFilter[i - 1]) > dif * threshold:
            signals[i] = (1 if y[i] > avgFilter[i - 1] else -1)
            avgFilter[i] = np.mean(y[(i - lag):i])
            y[i] = avgFilter[i - 1]
        else:
            signals[i] = 0
            avgFilter[i] = np.mean(y[(i - lag):i])

        dif_li[i] = dif

    return dict(signals=np.asarray(signals),
                avgFilter=np.asarray(avgFilter),
                y=np.asarray(y),
                dif=np.asarray(dif_li),
                )

public static Map<String, double[]> thresholding_algo(double[] y, int lag, double threshold) {

    double[] signals = new double[y.length];
    double[] avgFilter = new double[y.length];
    Arrays.fill(avgFilter, 0.0);

    avgFilter[lag - 1] = mean(Arrays.copyOfRange(y, 0, lag));
    double[] dif_li = new double[y.length];
    Arrays.fill(dif_li, 0.0);

    for (int i = lag; i < y.length; i++) {
        int j;
        if (i < y.length - lag - 30) {
            for (j = i + 11; j < y.length; j++) {
                if (y[j] >= y[i - 1]) {
                    break;
                }
            }
            double back;
            if (j >= y.length - 30) {
                back = y[i - 1];
            } else {
                back = mean(Arrays.copyOfRange(y, j + 11, j + 20 + lag));
            }
        } else {
            back = y[i - 1];
        }

        double tmp = Math.abs(back - avgFilter[i - 1]);
        double dif = tmp > 1 ? tmp : 1;

        if (Math.abs(y[i] - avgFilter[i - 1]) > dif * threshold) {
            signals[i] = y[i] > avgFilter[i - 1] ? 1 : -1;
            avgFilter[i] = mean(Arrays.copyOfRange(y, i - lag, i));
            y[i] = avgFilter[i - 1];
        } else {
            signals[i] = 0;
            avgFilter[i] = mean(Arrays.copyOfRange(y, i - lag, i));
        }

        dif_li[i] = dif;
    }

    Map<String, double[]> result = new HashMap<>();
    result.put("signals", signals);
    result.put("avgFilter", avgFilter);
    result.put("y", y);
    result.put("dif", dif_li);

    return result;
}

private static double mean(double[] array) {
    double sum = 0.0;
    for (double d : array) {
        sum += d;
    }
    return sum / array.length;
}

4. Code explanation

Usage: When we come to a new company and find that our former engineer has left a bunch of code that no one can understand, we don't want to be too happy if someone can help us explain what the code means.

def Fusion_algorithm(y_list):
    """
    最终的融合算法
    1、第一次遍历列表: 处理掉小于上一个值的点,使其等于上一个值。
    2、第二次使用z-score来处理异常点:一种基于统计方法的时序异常检测算法借鉴了一些经典的统计方法,比如Z-score和移动平均线
    该算法将时间序列中的每个数据点都看作是来自一个正态分布,通过计算每个数据点与其临接数据点的平均值和标准差,可以获得Z-score
    并将其用于检测异常值,将z-score大于3的数据点视为异常值,缺点:如果异常点太多,则该算法的准确性较差。
    3、
    :param y_list: 传入需要处理的时间序列
    :return:
    """
    # 第一次处理
    for i in range(1, len(y_list)):
        difference = y_list[i] - y_list[i - 1]
        if difference <= 0:
            y_list[i] = y_list[i - 1]
        # 基于突变检测的方法:如果一个数据点的值与前一个数据点的值之间的差异超过某个阈值,
        # 则该数据点可能是一个突变的异常点。这种方法需要使用一些突变检测算法,如Z-score突变检测、CUSUM(Cumulative Sum)
        # else:
        #     if abs(difference) > 2 * np.mean(y_list[:i]):
        #         y_list[i] = y_list[i - 1]

    # 第二次处理
    # 计算每个点的移动平均值和标准差
    ma = np.mean(y_list)
    # std = np.std(np.array(y_list))
    std = np.std(y_list)
    # 计算Z-score
    z_score = [(x - ma) / std for x in y_list]
    # 检测异常值
    for i in range(len(y_list)):
        # 如果z-score大于3,则为异常点,去除
        if z_score[i] > 3:
            print(y_list[i])
            y_list[i] = y_list[i - 1]

    return y_list

Note: In the previous code explanation, we can see that the answer may be influenced by comments in the code. We will delete these comments and try again. For some unclear points in the explanation, we can continue to ask questions!

import numpy as np
from sklearn.ensemble import IsolationForest
import plotly.express as px
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
import json

def Fusion_algorithm(y_list):
    for i in range(1, len(y_list)):
        difference = y_list[i] - y_list[i - 1]
        if difference <= 0:
            y_list[i] = y_list[i - 1]
    
        # else:
        #     if abs(difference) > 2 * np.mean(y_list[:i]):
        #         y_list[i] = y_list[i - 1]


    ma = np.mean(y_list)
    std = np.std(y_list)
    z_score = [(x - ma) / std for x in y_list]
    for i in range(len(y_list)):
        if z_score[i] > 3:
            print(y_list[i])
            y_list[i] = y_list[i - 1]

    return y_list

5. Fix code errors

Usage: Found a bug after writing a piece of code? Let ChatGPT help you!

### Buggy Python
import Random
a = random.randint(1,12)
b = random.randint(1,12)
for i in range(10):
    question = "What is "+a+" x "+b+"? "
    answer = input(question)
    if answer = a*b
        print (Well done!)
    else:
        print("No.")

6. As an encyclopedia

Purpose: ChatGPT can explain all your questions! But listing the novel's features is a bit tricky. After testing, only science fiction can be listed, and other genres are not very good. Maybe ChatGPT training engineers are science fiction lovers!

7. Information Extraction

Usage: As a large model for natural language processing, how can we achieve less information extraction?

8. Chat with friends

Purpose: Enter the character of the other party to simulate chatting. This feature is not very complete, and there may be new games that I haven't discovered yet.

9. Idea Generator

Usage: Do you often encounter mental bottlenecks in innovation and don't know how to do it? Don't worry, let ChatGPT help you generate ideas!

Combining VR and secret rooms

Combined with AR

10. Interview Questions

Usage: Maybe you are a media worker and don't know how to write interview questions? ChatGPT can help you solve this problem.

interview question list

List of interview questions and give corresponding answers

11. Thesis Outline

Usage: This feature is simply not very satisfying for graduate students. I've always been frustrated with how to write an outline, and going straight to the outline has helped me a lot! For points not understood in the syllabus, please directly request further explanation from ChatGPT. Code can exist too! Which chapter is not well written, let ChatGPT arrange it directly, so that the paper can be finished quickly!

Create a thesis outline

explain the content of the outline

class PBA(nn.Module):
    def __init__(self, PerformanceThreshold, DistributionType, AttentionWeightRange):
        super(PBA, self).__init__()
        self.PerformanceThreshold = PerformanceThreshold
        self.DistributionType = DistributionType
        self.AttentionWeightRange = AttentionWeightRange
        
    def forward(self, input, performance_scores):
        # 计算注意力分数
        attention_scores = []
        for i in range(len(input)):
            if performance_scores[i] > self.PerformanceThreshold:
                attention_scores.append(performance_scores[i])
            else:
                attention_scores.append(0.0)
                
        # 将性能分数映射到注意力权重
        if self.DistributionType == "softmax":
            attention_weights = F.softmax(torch.tensor(attention_scores), dim=0)
        elif self.DistributionType == "sigmoid":
            attention_weights = torch.sigmoid(torch.tensor(attention_scores))
        else:
            raise ValueError("Unknown distribution type: {}".format(self.DistributionType))
        
        # 缩放注意力权重到指定范围
        attention_weights = attention_weights * (self.AttentionWeightRange[1] - self.AttentionWeightRange[0]) + self.AttentionWeightRange[0]
        
        # 计算加权输入
        weighted_input = torch.mul(input, attention_weights.unsqueeze(1).expand_as(input))
        output = torch.sum(weighted_input, dim=0)
        
        return output

12. Story creation

Usage: This feature is really cool. In the future, I can sketch it out myself and write a novel!

love story

horror story

13. Problem analogy

Usage: This is a great feature when you want to create a metaphor.

14. Create SQL requirements

Usage: Writing SQL can sometimes be a headache, and I can't remember it for a long time.

15. Sentiment Analysis

Purpose: This feature reminds me of a sentiment analysis task I did at a previous company.

16. Turn product descriptions into ads

Uses: This feature is great for merchants.

17. Keyword extraction

Purpose: The important role of NLP tasks, keyword extraction!

18. Chatbots

Usage: I won't say much, it's really good for chat and experience.

Summarize

I think role-playing is fun. Before the dialogue, add a sentence: If you are xxx.
Now there are some small programs that allow artificial intelligence to play some character dialogues, and these dialogues are realized using this method.

Guess you like

Origin blog.csdn.net/zyqytsoft/article/details/130652190