How to use PSO (Particle swarm optimization) to optimize objective function containing two terms one of them kmeans clustering?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hi
I used PSO before to optimize an objective function.Now I have an objective(fitness) function containing two terms; one of them described by k-means clustering ..Euclidean distance?
採用された回答
You have to pass a function handle as the objective function, but it does not have to be an anonymous function. You can pass the handle to a function that does extensive computation based on the inputs. The only requirement is that the output has to be a scalar.
If you are trying to minimize two distinct things simultaneously then you either need to decide their relative weighting to combine them into a scalar, or else you need to use gamultiobj() to find pareto fronts.
14 件のコメント
I do not understand that image?
You saw what is written in??
If you read it
You will see the objective function phi
the first term I made and I want to know how to implement the second term??
If any information you need I will give
This is what your image looks like at my end:

No phi, no first or second term.
that looks like weighted Euclidean not plain Euclidean .
Yes
Now ,how to make as code in MATLAB?
I have the Wi matrix so how to implement this weighted Euclidean distance?
To get results like these in the images

Walter Roberson
2019 年 1 月 21 日
編集済み: Walter Roberson
2019 年 1 月 21 日
Use a nested for loop if you need to.
total = 0;
for j = 1 : K
for i = 1 : N2
total = total + sum(sum((W(i) * bsxfun(@minus, V(mu(j)).^i, mu(j)))).^2));
end
end
Here I assume that V_(mu_j) must indicate a function named V that is being passed a scalar mu(j) and is returning a vector or array -- if V_mu_j is a scalar then it makes less sense to talk about a Euclidean distance. If mu(j) represents a vector or array, or Wi is a vector or array, the code might need to be revised. If we had information about the relative dimensions we might potentially be able to write much more compact code.
Wi : is vector
See the attached for more
information
informationDear Walter Roberson,
Is there is compact code after the description in the last two images?
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Particle Swarm についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)




