我怎么样识破罗永浩的(锤子手机)业绩做假地?!--用C#与数据挖掘技术
//教 罗永浩的工程师,如何在业绩--销量(预售量)上面做假(才能不被群众识破)。
换个说法是:从算法(和数据挖掘)角度讲,怎样的业绩(销量)才是正常的……而怎样的数据形态,就是在业绩上做假……
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinFA1LuoYongHao02
{//
public partial class Form1 : Form
{//
public Form1()
{
InitializeComponent();
}
//
protected override void OnPaint(PaintEventArgs e)
{//protected override void OnPaint(PaintEventArgs e
Graphics g = e.Graphics;
this.Width = 1224;// 1024;// 600; // 800;
this.Height = 700; // 800; //1024; // 800;
Pen pnBlue = new Pen(Color.Blue);
Pen pnG = new Pen(Color.Green);
Pen pnBlack = new Pen(Color.Black);
Pen pnR = new Pen(Color.Red);
int starx = 0;
int starxy = 0;
int endx = 1100;
int endy = 600;
int highY = 700;
//画 x轴
Point pt01x = new Point(100, endy-100);
Point pt02x = new Point(endx, endy-100);
g.DrawLine(pnBlue, pt01x, pt02x);
Font font01 = new Font("宋体", 10f);
Brush brush01 = Brushes.Blue;
for (int i = 0; i < 1100; ++i) //循环画坐标
{
if (0 == (i % 50) ) {
Point pt001x = new Point(100 + i, endy - 100);
string istr = i.ToString();
g.DrawString(istr, font01, brush01, pt001x);
} //if11
}//for11
string str1 = "X坐标为时间轴";
Font font = new Font("宋体", 30f);
Brush brush = Brushes.Red;
PointF point = new PointF(100 +800, 100+400);
//横着写还是竖着写呢?
System.Drawing.StringFormat sf = new System.Drawing.StringFormat();
//还是竖着写吧
sf.FormatFlags = StringFormatFlags.DirectionVertical;
g.DrawString(str1, font, brush, point); //, sf);
//画 y轴
Point pt11y = new Point(100, 100);
Point pt12y = new Point(100, endy-100);
g.DrawLine(pnBlue, pt11y, pt12y);
font01 = new Font("宋体", 10f);
brush01 = Brushes.Blue;
for (int i = 0; i < 900; ++i)
{
if (0 == (i % 20))
{
Point pt001x = new Point(100-30 , endy - (100 +i) );
string istr = i.ToString();
g.DrawString(istr, font01, brush01, pt001x);
} //if11
}//for11
str1 = "y轴-业绩(销量)";
font = new Font("宋体", 30f);
brush = Brushes.Red;
point = new PointF(100, 100);
//横着写还是竖着写呢?
sf = new System.Drawing.StringFormat();
//还是竖着写吧
sf.FormatFlags = StringFormatFlags.DirectionVertical;
g.DrawString(str1, font, brush, point, sf);
//模拟真实算法;
int trueY = 0;
Point pt1 = new Point(100 + 0, endy - (trueY + 100));
Point pt2 = pt1;
int trueXlast = 0;
int trueYlast = 0;
int gz = 2;// 5;// 10;
for (int i = 0; i < 799; i+=gz)
{
int trueX = i ;
Random rd = new Random(Guid.NewGuid().GetHashCode());
int buyy = rd.Next(0, 10);
Point pt3;
if (buyy > 8) // 8/10的时间用户不买, 2/10的用户买,用随机数模仿 客户购买习惯
{
trueY += gz;
pt2 = new Point(100+trueXlast, endy - trueY - 100);
g.DrawLine(pnBlack, pt1, pt2); //从 ptt1上次点, 画到 上次的 x点不变,y轴点 变化(蜡烛图 画蜡烛)
//ptt2 = new Point(100 + trueX , endy - trueY - 100);
}
else { pt2 = new Point(100+trueXlast, endy - trueY - 100);
}
pt3 = new Point(100 + trueX, endy - trueY - 100);
g.DrawLine(pnBlack, pt2, pt3); //从 上支蜡烛的终点,画到 下支蜡烛的起点
pt1 = pt3;
trueXlast = trueX;
trueYlast = trueY;
}
string str12 = "模拟真实(正常)销售率的销售线";
font = new Font("宋体", 20f);
brush = Brushes.Red;
point = new PointF(trueXlast, trueYlast +100+100+ 150);
//横着写还是竖着写呢?
System.Drawing.StringFormat sf12 = new System.Drawing.StringFormat();
//还是横着写吧
sf.FormatFlags = StringFormatFlags.DirectionVertical;
g.DrawString(str12, font, brush, point); //, sf);
//高销售率算法
trueY = 0;
pt1 = new Point(100 + 0, endy - (trueY + 100));
pt2 = pt1;
for (int i = 0; i < 799; i += gz)
{//for22
int trueX = i ;
Random rd = new Random(Guid.NewGuid().GetHashCode());
int buyy = rd.Next(0, 900);
Point pt3;
if (buyy <300) // 6/9的时间用户不买, 3/9的用户买,用随机数模仿 客户购买习惯
{
trueY += gz;
pt2 = new Point(100 + trueXlast, endy - trueY - 100);
g.DrawLine(pnR, pt1, pt2); //从 ptt1上次点, 画到 上次的 x点不变,y轴点 变化(蜡烛图 画蜡烛)
}
else
{
pt2 = new Point(100 + trueXlast, endy - trueY - 100);
}
pt3 = new Point(100 + trueX, endy - trueY - 100);
g.DrawLine(pnBlack, pt2, pt3); //从 上支蜡烛的终点,画到 下支蜡烛的起点
pt1 = pt3;
trueXlast = trueX;
trueYlast = trueY;
}//for22
str12 = "黑色为模拟正常的高销售率的销售线(业绩)";
font = new Font("宋体", 20f);
brush = Brushes.Red;
point = new PointF(trueXlast-100, trueYlast-100);
//横着写还是竖着写呢?
sf12 = new System.Drawing.StringFormat();
//还是横着写吧
sf.FormatFlags = StringFormatFlags.DirectionVertical;
g.DrawString(str12, font, brush, point); //, sf);
//
//------------------------------------------------------------------------------
//罗永浩算法
trueXlast = 0;
trueYlast = 0;
trueY = 0;
pt1 = new Point(100 + 0, endy - (trueY + 100));
pt2 = pt1;
for (int i = 0; i < 799; i += gz)
{//for22
int trueX = i;
Random rd = new Random(Guid.NewGuid().GetHashCode());
int buyy = rd.Next(0, 900);
Point pt3;
if (buyy < 100) // 8/9的时间用户不买, 1/9的用户买,用随机数模仿 客户购买习惯
{
trueY += 3* gz;
pt2 = new Point(100 + trueXlast, endy - trueY - 100);
g.DrawLine(pnR, pt1, pt2); //从 ptt1上次点, 画到 上次的 x点不变,y轴点 变化(蜡烛图 画蜡烛)
}
else
{
pt2 = new Point(100 + trueXlast, endy - trueY - 100);
}
pt3 = new Point(100 + trueX, endy - trueY - 100);
g.DrawLine(pnG, pt2, pt3); //从 上支蜡烛的终点,画到 下支蜡烛的起点
pt1 = pt3;
trueXlast = trueX;
trueYlast = trueY;
}//for22
str12 = "蓝色为“罗永浩”销售曲线:";
font = new Font("宋体", 20f);
brush = Brushes.Red;
point = new PointF(800, 400-100); //(trueXlast, trueYlast - 100);
//横着写还是竖着写呢?
sf12 = new System.Drawing.StringFormat();
//还是横着写吧
sf.FormatFlags = StringFormatFlags.DirectionVertical;
g.DrawString(str12, font, brush, point); //, sf);
//===========================================================
//------------------------------------------------------------------------------
//改进罗永浩算法!!
trueXlast = 0;
trueYlast = 0;
trueY = 0;
pt1 = new Point(100 + 0, endy - (trueY + 100));
pt2 = pt1;
for (int i = 0; i < 799; i += gz)
{//for22
int trueX = i;
Random rd = new Random(Guid.NewGuid().GetHashCode());
int buyy = rd.Next(0, 900);
Point pt3;
if (buyy < 100) // 8/9的时间用户不买, 1/9的用户买,用随机数模仿 客户购买习惯
{
Random rd01 = new Random(Guid.NewGuid().GetHashCode());
int buyy01 = rd01.Next(1,5);
trueY += buyy01 * gz;
pt2 = new Point(100 + trueXlast, endy - trueY - 100);
g.DrawLine(pnR, pt1, pt2); //从 ptt1上次点, 画到 上次的 x点不变,y轴点 变化(蜡烛图 画蜡烛)
}
else
{
pt2 = new Point(100 + trueXlast, endy - trueY - 100);
}
pt3 = new Point(100 + trueX, endy - trueY - 100);
g.DrawLine(pnBlue, pt2, pt3); //从 上支蜡烛的终点,画到 下支蜡烛的起点
pt1 = pt3;
trueXlast = trueX;
trueYlast = trueY;
}//for22
str12 = "绿色为“罗永浩”(放大3倍)销售曲线:";
font = new Font("宋体", 20f);
brush = Brushes.Red;
point = new PointF(300-100, 400 - 100); //(trueXlast, trueYlast - 100);
sf12 = new System.Drawing.StringFormat();
sf.FormatFlags = StringFormatFlags.DirectionVertical; //横着写
g.DrawString(str12, font, brush, point); //, sf);
//===========================================================
//
} //protected override void OnPaint(PaintEventArgs e
//
}//public partial class Form1 : Form
}//namespace WinFA1LuoYongHao02
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。