91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.05M
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2021-02-24
  • 語言: C#
  • 標簽: 算法??數據挖掘??數據??

資源簡介

private void Compute()
        {
            for (int i = 0; i < 100; i )
            {
                double distance = -1;
                for (int j = 0; j < 4; j )
                {
                    int tempDistance = (this.Center[j].X - this.Points[i].X) * (this.Center[j].X - this.Points[i].X) (this.Center[j].Y - this.Points[i].Y) * (this.Center[j].Y - this.Points[i].Y);

                    if ((Math.Sqrt(tempDistance) < distance) || j == 0)
                    {
                        distance = Math.Sqrt(tempDistance);
                        Points[i].Focus = j;
                    }
                }
            }
        }

        /// <summary>
        /// 更新中心
        /// </summary>
        private void UpdateCenter()
        {
            for (int i = 0; i < this.K; i )
            {
                int x = 0, y = 0, count = 0;
                for (int j = 0; j < 100; j )
                {
                    if (Points[j].Focus == i)
                    {
                        x = Points[j].X;
                        y = Points[j].Y;
                        count ;
                    }
                }
                //利用三目運算符,防止出現除以0的不合法運算
                x = x / (count == 0 ? 1 : count);
                y = y / (count == 0 ? 1 : count);
                Center[i].X = x;
                Center[i].Y = y;
            }
        }

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;


namespace?Kmeans
{
????public?struct?Point1
????{
????????public?int?X;
????????public?int?Y;
????????public?int?Focus;
????}

????public?partial?class?Form1?:?Form
????{
????????public?Point1[]?Points?=?new?Point1[100];

????????public?Point1[]?Center?=?new?Point1[4];
????????int?K?=?4;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????
????????????Random?randXY?=?new?Random();
????????????
????????????//初始化數據
????????????for?(int?i?=?0;?i?????????????{

????????????????Random?randFocus?=?new?Random();
????????????????//數據對象
????????????????Points[i]?=?new?Point1();
????????????????Points[i].X?=?randXY.Next(500);
????????????????Points[i].Y?=?randXY.Next(500)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????11264??2017-03-29?17:31??Kmeans\bin\Debug\Kmeans.exe

?????文件??????26112??2017-03-29?17:31??Kmeans\bin\Debug\Kmeans.pdb

?????文件??????11600??2017-03-30?14:34??Kmeans\bin\Debug\Kmeans.vshost.exe

?????文件????????490??2012-06-06?02:06??Kmeans\bin\Debug\Kmeans.vshost.exe.manifest

?????文件???????6854??2017-03-29?17:31??Kmeans\Form1.cs

?????文件???????2098??2012-07-27?15:46??Kmeans\Form1.Designer.cs

?????文件???????5814??2012-07-27?15:46??Kmeans\Form1.resx

?????文件???????4746??2017-03-29?14:37??Kmeans\Kmeans.csproj

?????文件????????452??2017-03-29?14:37??Kmeans\Kmeans.csproj.user

?????文件???????1533??2017-03-29?14:36??Kmeans\Kmeans.sln

????..A..H.?????22016??2017-03-30?17:28??Kmeans\Kmeans.suo

?????文件???????6234??2017-03-29?17:31??Kmeans\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

?????文件???????1343??2017-03-30?14:34??Kmeans\obj\x86\Debug\Kmeans.csproj.FileListAbsolute.txt

?????文件????????902??2017-03-29?14:37??Kmeans\obj\x86\Debug\Kmeans.csproj.GenerateResource.Cache

?????文件??????11264??2017-03-29?17:31??Kmeans\obj\x86\Debug\Kmeans.exe

?????文件????????180??2017-03-29?14:37??Kmeans\obj\x86\Debug\Kmeans.Form1.resources

?????文件??????26112??2017-03-29?17:31??Kmeans\obj\x86\Debug\Kmeans.pdb

?????文件?????101482??2012-07-27?14:51??Kmeans\obj\x86\Debug\ResolveAssemblyReference.cache

?????文件???????5496??2012-07-27?14:51??Kmeans\Program.cs

?????文件???????1344??2012-02-15?16:37??Kmeans\Properties\AssemblyInfo.cs

?????文件????????849??2017-03-29?14:36??Kmeans\UpgradeLog.xml

?????文件???????3348??2017-03-29?14:36??Kmeans\_UpgradeReport_Files\UpgradeReport.css

?????文件??????12505??2010-05-04?01:19??Kmeans\_UpgradeReport_Files\UpgradeReport.xslt

?????文件?????????69??2017-03-29?14:36??Kmeans\_UpgradeReport_Files\UpgradeReport_Minus.gif

?????文件?????????71??2017-03-29?14:36??Kmeans\_UpgradeReport_Files\UpgradeReport_Plus.gif

?????目錄??????????0??2012-02-15?16:37??Kmeans\obj\x86\Debug\TempPE

?????目錄??????????0??2017-03-29?17:31??Kmeans\obj\x86\Debug

?????目錄??????????0??2017-03-30?14:33??Kmeans\bin\Debug

?????目錄??????????0??2017-03-29?14:35??Kmeans\bin\Release

?????目錄??????????0??2012-02-15?16:37??Kmeans\obj\x86

............此處省略8個文件信息

評論

共有 條評論